From: Ruben Kerkhof Date: Sat, 5 Dec 2015 14:16:36 +0000 (+0100) Subject: unixsock: check return value of chmod X-Git-Tag: collectd-5.5.1~25^2~1 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=386f05a78c939ca88cb96bee8df9a2f9fdee967d;p=collectd.git unixsock: check return value of chmod CID #37948 Signed-off-by: Florian Forster --- 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)