X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Funixsock.c;h=1840e34c45a157825fd8a9b8052a1b56500480ca;hb=8361c1e963f9184c3c4d87197fd6996d667cdb3f;hp=e6c75a65644e7441425183fb1b041c9bb93274c0;hpb=1978dba8e613eb01581b3376a42137e6fe11ca1a;p=collectd.git diff --git a/src/unixsock.c b/src/unixsock.c index e6c75a65..1840e34c 100644 --- a/src/unixsock.c +++ b/src/unixsock.c @@ -127,7 +127,16 @@ static int us_open_socket (void) return (-1); } - chmod (sa.sun_path, sock_perms); + status = chmod (sa.sun_path, sock_perms); + if (status == -1) + { + char errbuf[1024]; + ERROR ("unixsock plugin: chmod failed: %s", + sstrerror (errno, errbuf, sizeof (errbuf))); + close (sock_fd); + sock_fd = -1; + return (-1); + } status = listen (sock_fd, 8); if (status != 0) @@ -142,7 +151,7 @@ static int us_open_socket (void) do { - char *grpname; + const char *grpname; struct group *g; struct group sg; char grbuf[2048]; @@ -359,7 +368,7 @@ static void *us_server_thread (void __attribute__((unused)) *arg) pthread_exit ((void *) 1); } - remote_fd = (int *) malloc (sizeof (int)); + remote_fd = malloc (sizeof (*remote_fd)); if (remote_fd == NULL) { char errbuf[1024];