mirror of
https://github.com/FelixKratz/SketchyBar
synced 2024-11-27 05:40:17 +00:00
set CLOEXEC flag for sockfd to avoid race condition in execve
This commit is contained in:
parent
f3d58959b8
commit
c1a50b1bfc
1 changed files with 1 additions and 1 deletions
|
@ -83,7 +83,7 @@ bool socket_daemon_begin_un(struct daemon *daemon, char *socket_path, socket_dae
|
|||
snprintf(socket_address.sun_path, sizeof(socket_address.sun_path), "%s", socket_path);
|
||||
unlink(socket_path);
|
||||
|
||||
if ((daemon->sockfd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
|
||||
if (((daemon->sockfd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) || fcntl(daemon->sockfd, F_SETFD, FD_CLOEXEC | fcntl(daemon->sockfd, F_GETFD))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue