forked from github/abduco
Set sticky bit on socket
According to the XDG Base Directory Specification this should prevent the file from being deleted by temporary cleanup procedures.
This commit is contained in:
parent
42962ff827
commit
15ae398ea5
2
server.c
2
server.c
|
|
@ -42,7 +42,7 @@ static int server_create_socket(const char *name) {
|
||||||
int r = bind(fd, (struct sockaddr*)&sockaddr, socklen);
|
int r = bind(fd, (struct sockaddr*)&sockaddr, socklen);
|
||||||
umask(mask);
|
umask(mask);
|
||||||
|
|
||||||
if (r == -1) {
|
if (r == -1 || chmod(sockaddr.sun_path, S_ISVTX|S_IRUSR|S_IWUSR) == -1) {
|
||||||
close(fd);
|
close(fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue