sad

simple audio daemon
git clone git://git.2f30.org/sad
Log | Files | Refs | LICENSE

commit 2b1a217ad6b4d4bc4978e4c414e7e55cd997a0ea
parent 6ccb6506c6f8e52ad99684bae382fe1af40a9a60
Author: sin <sin@2f30.org>
Date:   Thu, 25 Dec 2014 14:08:24 +0000

Fix docmd() return value

Diffstat:
Mcmd.c | 9++++-----
Msad.h | 3+++
2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/cmd.c b/cmd.c @@ -188,7 +188,7 @@ Cmd cmds[] = { }; /* shamelessly taken from isakmpd ui.c */ -void +int docmd(int clifd) { static char *buf = 0; @@ -221,10 +221,8 @@ docmd(int clifd) sz *= 2; } n = read(clifd, p, resid); - if (n == -1) - err(1, "read"); - if (!n) - return; + if (n <= 0) + return -1; resid -= n; while (n--) { /* @@ -247,4 +245,5 @@ docmd(int clifd) } p++; } + return 0; } diff --git a/sad.h b/sad.h @@ -48,6 +48,9 @@ extern int fdmax; extern Output *output; extern Decoder *decoder; +/* cmd.c */ +int docmd(int); + /* playlist.c */ Song *addplaylist(const char *); Song *findsong(const char *);