1
0
forked from bip/bip

drop fork priviledges when running.

This commit is contained in:
Arnaud Cornet 2008-10-31 19:38:12 +01:00
parent e8c6adedc9
commit 1cbb1b9b7a

View File

@ -1292,6 +1292,15 @@ int main(int argc, char **argv)
write(fd, buf, strlen(buf)); write(fd, buf, strlen(buf));
close(fd); close(fd);
#ifdef RLIMIT_NPROC
struct rlimit rlim;
/* fork() is not need anymore, disable it */
rlim.rlim_max = rlim.rlim_cur = 0;
if (setrlimit(RLIMIT_NPROC, &rlim))
fatal("Could not drop fork priviledges");
#endif
bip.listener = listen_new(conf_ip, conf_port, conf_css); bip.listener = listen_new(conf_ip, conf_port, conf_css);
if (!bip.listener) if (!bip.listener)
fatal("Could not create listening socket"); fatal("Could not create listening socket");