X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Funixsock.c;h=54a1e20d48aedf40a347bf901ff1718e518d00d5;hb=65caa4f56cbb859bf1538e8b309eb23b3294c9de;hp=664c0184a5d21a793e1fc529dcbe6fbdddfbcde8;hpb=f5adf265a374e5e0dba89a4a9903e7719dc57039;p=collectd.git diff --git a/src/unixsock.c b/src/unixsock.c index 664c0184..54a1e20d 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)