summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Meuser <jakemsr@cvs.openbsd.org>2008-12-11 10:59:50 +0000
committerJacob Meuser <jakemsr@cvs.openbsd.org>2008-12-11 10:59:50 +0000
commitf1fe9c133c759500d08fef954dfd9bd559ee1e64 (patch)
treee0538ebcfb975f0e22cf3b1c91dca0ec285a6e80
parenta51e2717bab928852e43bdc16dc7e8723ee775d3 (diff)
don't try to sio_close a NULL sio_hdl. stops cdio from segfaulting
when /dev/audio is busy or AUDIODEVICE is not set correctly. commit it! ratchov@
-rw-r--r--usr.bin/cdio/rip.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/cdio/rip.c b/usr.bin/cdio/rip.c
index 2348dffaa9b..36351468d3b 100644
--- a/usr.bin/cdio/rip.c
+++ b/usr.bin/cdio/rip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rip.c,v 1.9 2008/11/29 08:57:10 jakemsr Exp $ */
+/* $OpenBSD: rip.c,v 1.10 2008/12/11 10:59:49 jakemsr Exp $ */
/*
* Copyright (c) 2007 Alexey Vatchenko <av@bsdua.org>
@@ -503,8 +503,10 @@ play_next_track(struct track_info *info)
return (NXTRACK_OK);
bad:
- sio_close(info->hdl);
- info->hdl = NULL;
+ if (info->hdl != NULL) {
+ sio_close(info->hdl);
+ info->hdl = NULL;
+ }
return (NXTRACK_FAIL);
}