diff options
author | sos <sos@FreeBSD.org> | 2002-12-18 07:43:42 +0000 |
---|---|---|
committer | sos <sos@FreeBSD.org> | 2002-12-18 07:43:42 +0000 |
commit | 923d0189b0e66fd8d78e58097548ede123fa0bd4 (patch) | |
tree | 3e6be31d695aafc1f8b51c26882f4aab20f6448e /usr.sbin | |
parent | 33a843a7245ab6a5ddba7325f3db55ec5bd727cc (diff) | |
download | FreeBSD-src-923d0189b0e66fd8d78e58097548ede123fa0bd4.zip FreeBSD-src-923d0189b0e66fd8d78e58097548ede123fa0bd4.tar.gz |
On drives that returns 00 as 100% done, lower the criteria
for wraparound, 99 was too much for fast drives since they
do not give 99 as the last value, but instead something
in the 90's range.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/burncd/burncd.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/usr.sbin/burncd/burncd.c b/usr.sbin/burncd/burncd.c index b630d94..ba9ceda 100644 --- a/usr.sbin/burncd/burncd.c +++ b/usr.sbin/burncd/burncd.c @@ -178,7 +178,7 @@ main(int argc, char **argv) } if ((!strcasecmp(argv[arg], "erase") || !strcasecmp(argv[arg], "blank")) && !test_write) { - int error, blank, percent, last = 0; + int blank, pct, last = 0; if (!strcasecmp(argv[arg], "erase")) blank = CDR_B_ALL; @@ -192,16 +192,16 @@ main(int argc, char **argv) err(EX_IOERR, "ioctl(CDRIOCBLANK)"); while (1) { sleep(1); - error = ioctl(fd, CDRIOCGETPROGRESS, &percent); - if (percent > 0 && !quiet) + if (ioctl(fd, CDRIOCGETPROGRESS, &pct) == -1) + err(EX_IOERR,"ioctl(CDRIOGETPROGRESS)"); + if (pct > 0 && !quiet) fprintf(stderr, "%sing CD - %d %% done \r", blank == CDR_B_ALL ? - "eras" : "blank", percent); - if (error || percent == 100 || - (percent == 0 && last == 99)) + "eras" : "blank", pct); + if (pct == 100 || (pct == 0 && last > 90)) break; - last = percent; + last = pct; } if (!quiet) printf("\n"); @@ -503,7 +503,7 @@ do_format(int fd, int force, char *type) { struct cdr_format_capacities capacities; struct cdr_format_params format_params; - int count, i, percent, last = 0; + int count, i, pct, last = 0; if (ioctl(fd, CDRIOCREADFORMATCAPS, &capacities) == -1) err(EX_IOERR, "ioctl(CDRIOCREADFORMATCAPS)"); @@ -562,14 +562,14 @@ do_format(int fd, int force, char *type) while (1) { sleep(1); - if (ioctl(fd, CDRIOCGETPROGRESS, &percent) == -1) + if (ioctl(fd, CDRIOCGETPROGRESS, &pct) == -1) err(EX_IOERR, "ioctl(CDRIOGETPROGRESS)"); - if (percent > 0 && !quiet) + if (pct > 0 && !quiet) fprintf(stderr, "formatting DVD - %d %% done \r", - percent); - if (percent == 100 || (percent == 0 && last == 99)) + pct); + if (pct == 100 || (pct == 0 && last > 90)) break; - last = percent; + last = pct; } if (!quiet) fprintf(stderr, "\n"); |