diff options
author | Michael Coulter <mjc@cvs.openbsd.org> | 2006-06-21 21:53:37 +0000 |
---|---|---|
committer | Michael Coulter <mjc@cvs.openbsd.org> | 2006-06-21 21:53:37 +0000 |
commit | 7b75955a95758fd98b6f6eb8fd05910a961b2837 (patch) | |
tree | 0755e278f8e0e39563db2e9e4a064f42cc39343b /usr.bin/cdio | |
parent | c4c2198d9316130a94cbefc07d774b308c91e53c (diff) |
retry if sense code indicates not ready. fixes writing for drives
that issue long write in progress if the write buffer is full.
ok deraadt@
Diffstat (limited to 'usr.bin/cdio')
-rw-r--r-- | usr.bin/cdio/mmc.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/cdio/mmc.c b/usr.bin/cdio/mmc.c index a77b8fe808a..ab37ffdfff3 100644 --- a/usr.bin/cdio/mmc.c +++ b/usr.bin/cdio/mmc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mmc.c,v 1.11 2006/06/15 23:49:58 mjc Exp $ */ +/* $OpenBSD: mmc.c,v 1.12 2006/06/21 21:53:36 mjc Exp $ */ /* * Copyright (c) 2006 Michael Coulter <mjc@openbsd.org> @@ -217,11 +217,16 @@ writetrack(struct track_info *tr) read(tr->fd, databuf, nblk * tr->blklen); scr.cmd[8] = nblk; scr.datalen = nblk * tr->blklen; +again: r = ioctl(fd, SCIOCCOMMAND, &scr); if (r != 0) { warn("ioctl failed while attempting to write"); return (-1); } + if (scr.retsts == SCCMD_SENSE && scr.sense[2] == 0x2) { + usleep(1000); + goto again; + } if (scr.retsts != SCCMD_OK) { warnx("ioctl returned bad status while " "attempting to write: %d", |