projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #1821 from rubenk/memset
[collectd.git]
/
src
/
daemon
/
common.c
diff --git
a/src/daemon/common.c
b/src/daemon/common.c
index
546da3b
..
9da4775
100644
(file)
--- a/
src/daemon/common.c
+++ b/
src/daemon/common.c
@@
-36,10
+36,6
@@
#include "plugin.h"
#include "utils_cache.h"
#include "plugin.h"
#include "utils_cache.h"
-#if HAVE_PTHREAD_H
-# include <pthread.h>
-#endif
-
#ifdef HAVE_MATH_H
# include <math.h>
#endif
#ifdef HAVE_MATH_H
# include <math.h>
#endif
@@
-275,6
+271,9
@@
ssize_t swrite (int fd, const void *buf, size_t count)
ptr = (const char *) buf;
nleft = count;
ptr = (const char *) buf;
nleft = count;
+ if (fd < 0)
+ return (-1);
+
/* checking for closed peer connection */
pfd.fd = fd;
pfd.events = POLLIN | POLLHUP;
/* checking for closed peer connection */
pfd.fd = fd;
pfd.events = POLLIN | POLLHUP;
@@
-1519,7
+1518,7
@@
int service_name_to_port_number (const char *service_name)
{
struct addrinfo *ai_list;
struct addrinfo *ai_ptr;
{
struct addrinfo *ai_list;
struct addrinfo *ai_ptr;
- struct addrinfo ai_hints;
+ struct addrinfo ai_hints
= { 0 }
;
int status;
int service_number;
int status;
int service_number;
@@
-1527,7
+1526,6
@@
int service_name_to_port_number (const char *service_name)
return (-1);
ai_list = NULL;
return (-1);
ai_list = NULL;
- memset (&ai_hints, 0, sizeof (ai_hints));
ai_hints.ai_family = AF_UNSPEC;
status = getaddrinfo (/* node = */ NULL, service_name,
ai_hints.ai_family = AF_UNSPEC;
status = getaddrinfo (/* node = */ NULL, service_name,