diff options
author | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2007-08-02 07:31:17 +0000 |
---|---|---|
committer | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2007-08-02 07:31:17 +0000 |
commit | aaf57883677a02a917aa2c219f40b41621145f3d (patch) | |
tree | 89554a3b6bffac20b88c2895f3f71145deb85298 /usr.bin/cdio | |
parent | ec36f7091200b0ca1922f2234767ceb7f4a0e4f4 (diff) |
exit when /dev/audio can't be opened.
from Alexey Vatchenko <av@bsdua.org>
ok theo
Diffstat (limited to 'usr.bin/cdio')
-rw-r--r-- | usr.bin/cdio/rip.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/usr.bin/cdio/rip.c b/usr.bin/cdio/rip.c index 0d5997b4c94..47bbbf9b12a 100644 --- a/usr.bin/cdio/rip.c +++ b/usr.bin/cdio/rip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rip.c,v 1.6 2007/07/31 21:21:11 deraadt Exp $ */ +/* $OpenBSD: rip.c,v 1.7 2007/08/02 07:31:16 jakemsr Exp $ */ /* * Copyright (c) 2007 Alexey Vatchenko <av@bsdua.org> @@ -451,7 +451,7 @@ play_next_track(struct track_info *info) S_IRUSR | S_IWUSR); if (info->fd == -1) { warnx("can't open /dev/audio"); - return (NXTRACK_SKIP); /* just skip this track */ + return (NXTRACK_FAIL); } fd = open("/dev/audioctl", O_RDWR); @@ -518,20 +518,18 @@ rip_tracks_loop(struct track_pair *tp, u_int n_tracks, } error = next_track(&info); - if (error == NXTRACK_SKIP) - continue; - else if (error == NXTRACK_FAIL) { + if (error == NXTRACK_FAIL) { error = -1; break; - } - - error = read_track(fd, &info); - close(info.fd); - - if (error != 0) { - warnx("can't rip %u track", - toc_buffer[i].track); - break; + } else if (error != NXTRACK_SKIP) { + error = read_track(fd, &info); + close(info.fd); + + if (error != 0) { + warnx("can't rip %u track", + toc_buffer[i].track); + break; + } } } |