X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Funixsock.c;h=795f7abe2120f7e4d4930895f9c1af014a7addeb;hb=4ea7aebc3f05d082f64a62c679f414cf7cb0e631;hp=664c0184a5d21a793e1fc529dcbe6fbdddfbcde8;hpb=21a4ddcc2d66eea59224fd95746c7533b1b1a46d;p=collectd.git diff --git a/src/unixsock.c b/src/unixsock.c index 664c0184..795f7abe 100644 --- a/src/unixsock.c +++ b/src/unixsock.c @@ -39,7 +39,6 @@ /* Folks without pthread will need to disable this plugin. */ #include -#include #include #include @@ -128,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) @@ -143,7 +151,7 @@ static int us_open_socket (void) do { - char *grpname; + const char *grpname; struct group *g; struct group sg; char grbuf[2048];