X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Funixsock.c;h=8b2f33914eacc3307fbc7d1b28c9c5fe032b3c74;hb=924bfe28d5be1058ccf50931d77639212fb28346;hp=2c1665fc9fcbbdffc3c91935838a720e4fbf6d6f;hpb=7a762196fa7a4024c19ceac9b0c6918a5d8f62d5;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)