mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
[MEDIUM] fixed call to chroot() during startup
It wasn't very wise to chroot() early during the startup. Also, the exit() was missing if the chroot() failed.
This commit is contained in:
parent
e94ebd0e37
commit
f223cc0b5c
@ -870,16 +870,6 @@ int main(int argc, char **argv)
|
||||
pidfile = fdopen(pidfd, "w");
|
||||
}
|
||||
|
||||
/* chroot if needed */
|
||||
if (global.chroot != NULL) {
|
||||
if (chroot(global.chroot) == -1) {
|
||||
Alert("[%s.main()] Cannot chroot(%s).\n", argv[0], global.chroot);
|
||||
if (nb_oldpids)
|
||||
tell_old_pids(SIGTTIN);
|
||||
}
|
||||
chdir("/");
|
||||
}
|
||||
|
||||
/* ulimits */
|
||||
if (!global.rlimit_nofile)
|
||||
global.rlimit_nofile = global.maxsock;
|
||||
@ -940,6 +930,17 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* chroot if needed */
|
||||
if (global.chroot != NULL) {
|
||||
if (chroot(global.chroot) == -1) {
|
||||
Alert("[%s.main()] Cannot chroot(%s).\n", argv[0], global.chroot);
|
||||
if (nb_oldpids)
|
||||
tell_old_pids(SIGTTIN);
|
||||
exit(1);
|
||||
}
|
||||
chdir("/");
|
||||
}
|
||||
|
||||
if (nb_oldpids)
|
||||
tell_old_pids(oldpids_sig);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user