summaryrefslogtreecommitdiffstats
path: root/src/util.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2013-12-26 21:51:15 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2013-12-26 21:51:15 +0000
commit84ca6e5f336670b6d5dc13927261c8549803bced (patch)
treeb43027dca78a6c1ffd6bd6baf8e7d773b662da4f /src/util.c
parentc4f1a535f859c16daef88e2b4ad1bddd198597c1 (diff)
downloadrspamd-84ca6e5f336670b6d5dc13927261c8549803bced.tar.gz
rspamd-84ca6e5f336670b6d5dc13927261c8549803bced.zip
Fix some cases in unix socket creation.
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/util.c b/src/util.c
index 50dbf7a37..b537e8827 100644
--- a/src/util.c
+++ b/src/util.c
@@ -220,8 +220,8 @@ accept_from_socket (gint listen_sock, struct sockaddr *addr, socklen_t * len)
gint
make_unix_socket (const gchar *path, struct sockaddr_un *addr, gint type, gboolean is_server, gboolean async)
{
- gint fd, s_error, r, optlen, serrno, on = 1;
- struct stat st;
+ gint fd = -1, s_error, r, optlen, serrno, on = 1;
+ struct stat st;
if (path == NULL)
return -1;
@@ -307,7 +307,9 @@ make_unix_socket (const gchar *path, struct sockaddr_un *addr, gint type, gboole
out:
serrno = errno;
- close (fd);
+ if (fd != -1) {
+ close (fd);
+ }
errno = serrno;
return (-1);
}