From aaf57883677a02a917aa2c219f40b41621145f3d Mon Sep 17 00:00:00 2001 From: Jacob Meuser Date: Thu, 2 Aug 2007 07:31:17 +0000 Subject: exit when /dev/audio can't be opened. from Alexey Vatchenko ok theo --- usr.bin/cdio/rip.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'usr.bin/cdio') 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 @@ -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; + } } } -- cgit v1.2.3