diff options
author | Baptiste Daroussin <bapt@FreeBSD.org> | 2015-03-25 08:13:47 +0100 |
---|---|---|
committer | Baptiste Daroussin <bapt@FreeBSD.org> | 2015-03-25 08:13:47 +0100 |
commit | eaf5d6bf801baa6169d388b910a75f8108499239 (patch) | |
tree | dc476a4dd0c30ac3808103d1f5a912d0cd257c8e /src/print_volume.c | |
parent | e9fc4c1c0640cf21a85d4798aac20323100eac68 (diff) |
print_volume: don’t return, complete the buffer first
Follow the changed done for Linux on f0cd726b
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"); |