From 386f05a78c939ca88cb96bee8df9a2f9fdee967d Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Sat, 5 Dec 2015 15:16:36 +0100 Subject: [PATCH] unixsock: check return value of chmod CID #37948 Signed-off-by: Florian Forster --- src/unixsock.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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) -- 2.30.2