From 15ae398ea51f9adb282d7cf93a998a8ea401fd21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Mon, 3 Aug 2015 12:30:27 +0200 Subject: [PATCH] Set sticky bit on socket According to the XDG Base Directory Specification this should prevent the file from being deleted by temporary cleanup procedures. --- server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.c b/server.c index 722b817..c47db50 100644 --- a/server.c +++ b/server.c @@ -42,7 +42,7 @@ static int server_create_socket(const char *name) { int r = bind(fd, (struct sockaddr*)&sockaddr, socklen); umask(mask); - if (r == -1) { + if (r == -1 || chmod(sockaddr.sun_path, S_ISVTX|S_IRUSR|S_IWUSR) == -1) { close(fd); return -1; }