Set FD_CLOEXEC on scriptd(Sock|Stream).

These have no reason to be inherited by the script when it is
run by posix_spawn().
This commit is contained in:
Nicholas J. Kain 2022-09-07 17:25:22 -04:00
parent f7db9fd5e7
commit 5eccd4893a
No known key found for this signature in database

View File

@ -10,6 +10,7 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <sys/prctl.h> #include <sys/prctl.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h>
#include "nk/log.h" #include "nk/log.h"
#include "nk/io.h" #include "nk/io.h"
#include "nk/pspawn.h" #include "nk/pspawn.h"
@ -153,6 +154,8 @@ void scriptd_main(void)
prctl(PR_SET_NAME, "ndhc: scriptd"); prctl(PR_SET_NAME, "ndhc: scriptd");
umask(077); umask(077);
setup_signals_scriptd(); setup_signals_scriptd();
fcntl(scriptdSock[1], F_SETFD, FD_CLOEXEC);
fcntl(scriptdStream[1], F_SETFD, FD_CLOEXEC);
do_scriptd_work(); do_scriptd_work();
} }