diff options
Diffstat (limited to 'usr.bin/cdio/mmc.c')
-rw-r--r-- | usr.bin/cdio/mmc.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/usr.bin/cdio/mmc.c b/usr.bin/cdio/mmc.c index a582a2493ac..e30b8c260dc 100644 --- a/usr.bin/cdio/mmc.c +++ b/usr.bin/cdio/mmc.c @@ -3,6 +3,7 @@ #include <sys/stat.h> #include <sys/scsiio.h> #include <err.h> +#include <errno.h> #include <fcntl.h> #include <stdio.h> #include <string.h> @@ -10,7 +11,9 @@ #include "extern.h" #define WAVHDRLEN 44 +extern int errno; extern int fd; +extern char *cdname; extern char *track_types; int @@ -29,6 +32,13 @@ blank(void) scr.senselen = SENSEBUFLEN; r = ioctl(fd, SCIOCCOMMAND, &scr); + if (r == -1 && errno == EPERM) { + close(fd); + fd = -1; + if (! open_cd(cdname, 1)) + return (-1); + } + r = ioctl(fd, SCIOCCOMMAND, &scr); return (r == 0 ? scr.retsts : -1); } |