From: Roy Marples Date: Sat, 11 Jul 2009 07:03:23 +0000 (+0000) Subject: Use ssize_t which is a signed int and test if read() returns -1. X-Git-Tag: v5.0.7~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e8dcac713baa5074d800cdeb571c8fb74d6fab1e;p=thirdparty%2Fdhcpcd.git Use ssize_t which is a signed int and test if read() returns -1. --- diff --git a/signals.c b/signals.c index f5c67ed5..07dfbfeb 100644 --- a/signals.c +++ b/signals.c @@ -67,11 +67,11 @@ signal_read(void) { int sig = -1; char buf[16]; - size_t bytes; + ssize_t bytes; memset(buf, 0, sizeof(buf)); bytes = read(signal_pipe[0], buf, sizeof(buf)); - if (bytes >= sizeof(sig)) + if (bytes >= 0 && bytes >= sizeof(sig)) memcpy(&sig, buf, sizeof(sig)); return sig; }