From d54f3b1640ee23b5213ac870ca3de558f54e8247 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Sun, 5 Jun 2016 13:53:17 +0200 Subject: [PATCH] swrite: return error if fd is negative --- src/daemon/common.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/daemon/common.c b/src/daemon/common.c index f82efe33..4c271d34 100644 --- a/src/daemon/common.c +++ b/src/daemon/common.c @@ -273,6 +273,9 @@ ssize_t swrite (int fd, const void *buf, size_t count) ptr = (const char *) buf; nleft = count; + if (fd < 0) + return (-1); + /* checking for closed peer connection */ pfd.fd = fd; pfd.events = POLLIN | POLLHUP; -- 2.11.0