projects
/
collectd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
(from parent 1:
edd9af8
)
Merge pull request #1746 from rubenk/swrite-check-for-open-fd
author
Sebastian Harl
<sh@tokkee.org>
Sun, 5 Jun 2016 12:27:11 +0000
(14:27 +0200)
committer
Sebastian Harl
<sh@tokkee.org>
Sun, 5 Jun 2016 12:27:11 +0000
(14:27 +0200)
swrite: return error if fd is negative
src/daemon/common.c
patch
|
blob
|
history
diff --git
a/src/daemon/common.c
b/src/daemon/common.c
index
f82efe3
..
4c271d3
100644
(file)
--- 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;