summaryrefslogtreecommitdiff
path: root/sysdep/unix/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdep/unix/main.c')
-rw-r--r--sysdep/unix/main.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sysdep/unix/main.c b/sysdep/unix/main.c
index 31094c52..61b306dc 100644
--- a/sysdep/unix/main.c
+++ b/sysdep/unix/main.c
@@ -463,7 +463,12 @@ cli_init_unix(uid_t use_uid, gid_t use_gid)
s->type = SK_UNIX_PASSIVE;
s->rx_hook = cli_connect;
s->rbsize = 1024;
- sk_open_unix(s, path_control_socket);
+
+ /* Return value intentionally ignored */
+ unlink(path_control_socket);
+
+ if (sk_open_unix(s, path_control_socket) < 0)
+ die("Cannot create control socket %s: %m", path_control_socket);
if (use_uid || use_gid)
if (chown(path_control_socket, use_uid, use_gid) < 0)