From db2f8439952c771ca1d560df9057c81ed4ca8293 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 12 Jul 2006 02:34:23 +0000 Subject: OSS: correctly check for the device in oss_testDefault() open(2) returns -1 on error (if the device does not exist), and -1 is true. Also, put shank's name in the copyright header since half the code is his (including this bug :P). git-svn-id: https://svn.musicpd.org/mpd/trunk@4310 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/audioOutputs/audioOutput_oss.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/audioOutputs/audioOutput_oss.c b/src/audioOutputs/audioOutput_oss.c index ee3f4e19a..2194b83ae 100644 --- a/src/audioOutputs/audioOutput_oss.c +++ b/src/audioOutputs/audioOutput_oss.c @@ -2,7 +2,8 @@ * (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu) * This project's homepage is: http://www.musicpd.org * - * OSS audio output (c) 2004 by Eric Wong + * OSS audio output (c) 2004, 2005, 2006 by Eric Wong + * and Warren Dukes * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -302,7 +303,7 @@ static int oss_testDefault() { fd = open("/dev/sound/dsp", O_WRONLY); - if(fd) { + if(fd >= 0) { close(fd); return 0; } @@ -312,7 +313,7 @@ static int oss_testDefault() { fd = open("/dev/dsp", O_WRONLY); - if(fd) { + if(fd >= 0) { close(fd); return 0; } -- cgit v1.2.3