X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Funixsock.c;h=8b2f33914eacc3307fbc7d1b28c9c5fe032b3c74;hb=8af74098eb65ff4c0c0cc65dfaa40973fe741a63;hp=2c1665fc9fcbbdffc3c91935838a720e4fbf6d6f;hpb=affac33e83584e7538c358e3bd0a587d0c692bc3;p=collectd.git diff --git a/src/unixsock.c b/src/unixsock.c index 2c1665fc..8b2f3391 100644 --- a/src/unixsock.c +++ b/src/unixsock.c @@ -122,7 +122,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)