commit 940aa150484d85dfc2c00db5f58024c9beab3105
parent 456796c199e679e264ee66e6bfd9c08e62b67c8f
Author: sin <sin@2f30.org>
Date: Fri, 26 Dec 2014 15:43:00 +0000
Report failures to change volume
We should fix this so that we can change volume even if a song
is not playing by having a `volumepending' var and setting it
at open() time.
Diffstat:
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/cmd.c b/cmd.c
@@ -31,7 +31,11 @@ cmdvolume(int fd, int argc, char **argv)
dprintf(fd, "ERR \"volume should be between [0, 100]\"\n");
return;
}
- output->vol(vol);
+ if (output->vol(vol) < 0) {
+ dprintf(fd, "ERR \"failed to change volume\"\n");
+ return;
+ }
+ dprintf(fd, "OK\n");
}
static void
diff --git a/sndio.c b/sndio.c
@@ -17,8 +17,9 @@ sndiovol(int vol)
warnx("sio_setvol: failed");
return -1;
}
+ return 0;
}
- return 0;
+ return -1;
}
static int