Hide OSS and Solaris devices if their files can't be stat'd
This commit is contained in:
@@ -169,7 +169,8 @@ static ALCboolean oss_open_playback(ALCdevice *device, const ALCchar *deviceName
|
||||
if(data->fd == -1)
|
||||
{
|
||||
free(data);
|
||||
AL_PRINT("Could not open %s: %s\n", driver, strerror(errno));
|
||||
if(errno != ENOENT)
|
||||
AL_PRINT("Could not open %s: %s\n", driver, strerror(errno));
|
||||
return ALC_FALSE;
|
||||
}
|
||||
|
||||
@@ -336,7 +337,8 @@ static ALCboolean oss_open_capture(ALCdevice *device, const ALCchar *deviceName)
|
||||
if(data->fd == -1)
|
||||
{
|
||||
free(data);
|
||||
AL_PRINT("Could not open %s: %s\n", driver, strerror(errno));
|
||||
if(errno != ENOENT)
|
||||
AL_PRINT("Could not open %s: %s\n", driver, strerror(errno));
|
||||
return ALC_FALSE;
|
||||
}
|
||||
|
||||
@@ -492,9 +494,27 @@ void alc_oss_deinit(void)
|
||||
void alc_oss_probe(int type)
|
||||
{
|
||||
if(type == DEVICE_PROBE)
|
||||
AppendDeviceList(oss_device);
|
||||
{
|
||||
#ifdef HAVE_STAT
|
||||
struct stat buf;
|
||||
if(stat(GetConfigValue("oss", "device", "/dev/dsp"), &buf) == 0)
|
||||
#endif
|
||||
AppendDeviceList(oss_device);
|
||||
}
|
||||
else if(type == ALL_DEVICE_PROBE)
|
||||
AppendAllDeviceList(oss_device);
|
||||
{
|
||||
#ifdef HAVE_STAT
|
||||
struct stat buf;
|
||||
if(stat(GetConfigValue("oss", "device", "/dev/dsp"), &buf) == 0)
|
||||
#endif
|
||||
AppendAllDeviceList(oss_device);
|
||||
}
|
||||
else if(type == CAPTURE_DEVICE_PROBE)
|
||||
AppendCaptureDeviceList(oss_device_capture);
|
||||
{
|
||||
#ifdef HAVE_STAT
|
||||
struct stat buf;
|
||||
if(stat(GetConfigValue("oss", "capture", "/dev/dsp"), &buf) == 0)
|
||||
#endif
|
||||
AppendCaptureDeviceList(oss_device_capture);
|
||||
}
|
||||
}
|
||||
|
||||
+8
-1
@@ -112,7 +112,8 @@ static ALCboolean solaris_open_playback(ALCdevice *device, const ALCchar *device
|
||||
if(data->fd == -1)
|
||||
{
|
||||
free(data);
|
||||
AL_PRINT("Could not open %s: %s\n", driver, strerror(errno));
|
||||
if(errno != ENOENT)
|
||||
AL_PRINT("Could not open %s: %s\n", driver, strerror(errno));
|
||||
return ALC_FALSE;
|
||||
}
|
||||
|
||||
@@ -291,6 +292,12 @@ void alc_solaris_deinit(void)
|
||||
|
||||
void alc_solaris_probe(ALCboolean capture)
|
||||
{
|
||||
#ifdef HAVE_STAT
|
||||
struct stat buf;
|
||||
if(stat(GetConfigValue("solaris", "device", "/dev/audio"), &buf) != 0)
|
||||
return;
|
||||
#endif
|
||||
|
||||
if(type == DEVICE_PROBE)
|
||||
AppendDeviceList(solaris_device);
|
||||
else if(type == ALL_DEVICE_PROBE)
|
||||
|
||||
@@ -152,6 +152,7 @@ ENDIF()
|
||||
CHECK_FUNCTION_EXISTS(strtof HAVE_STRTOF)
|
||||
CHECK_FUNCTION_EXISTS(_controlfp HAVE__CONTROLFP)
|
||||
|
||||
CHECK_FUNCTION_EXISTS(stat HAVE_STAT)
|
||||
CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP)
|
||||
IF(NOT HAVE_STRCASECMP)
|
||||
CHECK_FUNCTION_EXISTS(_stricmp HAVE__STRICMP)
|
||||
|
||||
@@ -28,6 +28,9 @@
|
||||
/* Define if we have dlfcn.h */
|
||||
#cmakedefine HAVE_DLFCN_H
|
||||
|
||||
/* Define if we have the stat function */
|
||||
#cmakedefine HAVE_STAT
|
||||
|
||||
/* Define if we have the sqrtf function */
|
||||
#cmakedefine HAVE_SQRTF
|
||||
|
||||
|
||||
Reference in New Issue
Block a user