diff options
author | Michael Stapelberg <stapelberg@users.noreply.github.com> | 2015-03-25 08:56:00 +0100 |
---|---|---|
committer | Michael Stapelberg <stapelberg@users.noreply.github.com> | 2015-03-25 08:56:00 +0100 |
commit | be583ea739fd2412138c1d73a01ca4a5ca4e9252 (patch) | |
tree | ce0a76d9f000ef1cd13eadb5ae2f126174846e6a /src/print_volume.c | |
parent | bf223d9b61498a6b1e723bacb007545a696141fe (diff) | |
parent | c9dc67e0542a0f540b014e8b2607bfc269433951 (diff) |
Merge pull request #13 from bapt/master
Fixes for FreeBSD
Diffstat (limited to 'src/print_volume.c')
-rw-r--r-- | src/print_volume.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/print_volume.c b/src/print_volume.c index ef1c913..bc469f3 100644 --- a/src/print_volume.c +++ b/src/print_volume.c @@ -3,6 +3,7 @@ #include <string.h> #include <stdlib.h> #include <stdio.h> +#include <err.h> #include <yajl/yajl_gen.h> #include <yajl/yajl_version.h> @@ -139,16 +140,22 @@ void print_volume(yajl_gen json_gen, char *buffer, const char *fmt, const char * else mixerpath = defaultmixer; - if ((mixfd = open(mixerpath, O_RDWR)) < 0) - return; + if ((mixfd = open(mixerpath, O_RDWR)) < 0) { + warn("OSS: Cannot open mixer"); + goto out; + } if (mixer_idx > 0) free(mixerpath); - if (ioctl(mixfd, SOUND_MIXER_READ_DEVMASK, &devmask) == -1) - return; - if (ioctl(mixfd, MIXER_READ(0), &vol) == -1) - return; + if (ioctl(mixfd, SOUND_MIXER_READ_DEVMASK, &devmask) == -1) { + warn("OSS: Cannot read mixer information"); + goto out; + } + if (ioctl(mixfd, MIXER_READ(0), &vol) == -1) { + warn("OSS: Cannot read mixer information"); + goto out; + } if (((vol & 0x7f) == 0) && (((vol >> 8) & 0x7f) == 0)) { START_COLOR("color_degraded"); |