summaryrefslogtreecommitdiff
path: root/backends/oss/oss-device.c
diff options
context:
space:
mode:
Diffstat (limited to 'backends/oss/oss-device.c')
-rw-r--r--backends/oss/oss-device.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/backends/oss/oss-device.c b/backends/oss/oss-device.c
index e89e6e8..70f46e6 100644
--- a/backends/oss/oss-device.c
+++ b/backends/oss/oss-device.c
@@ -274,18 +274,26 @@ oss_device_new (const gchar *name,
gint fd)
{
OssDevice *device;
+ gint newfd;
g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (label != NULL, NULL);
g_return_val_if_fail (path != NULL, NULL);
+ newfd = dup (fd);
+ if (newfd == -1) {
+ g_warning ("Failed to duplicate file descriptor: %s",
+ g_strerror (errno));
+ return NULL;
+ }
+
device = g_object_new (OSS_TYPE_DEVICE,
"name", name,
"label", label,
"icon", OSS_DEVICE_ICON,
NULL);
- device->priv->fd = dup (fd);
+ device->priv->fd = newfd;
device->priv->path = g_strdup (path);
return device;
@@ -584,6 +592,8 @@ read_mixer_devices (OssDevice *device)
device->priv->fd,
i,
stereo);
+ if G_UNLIKELY (control == NULL)
+ continue;
if (oss_stream_has_controls (stream) == FALSE) {
const gchar *name =