do detaching after user switch

This commit is contained in:
Erik Ekman 2007-03-01 21:41:17 +00:00
parent 264a5227de
commit 6a4dfb8cbd
2 changed files with 8 additions and 8 deletions

View File

@ -569,10 +569,6 @@ main(int argc, char **argv)
do_chroot(newroot); do_chroot(newroot);
if (!foreground) {
do_detach();
}
if (username) { if (username) {
if (setgid(pw->pw_gid) < 0 || setuid(pw->pw_uid) < 0) { if (setgid(pw->pw_gid) < 0 || setuid(pw->pw_uid) < 0) {
printf("Could not switch to user %s!\n", username); printf("Could not switch to user %s!\n", username);
@ -580,6 +576,10 @@ main(int argc, char **argv)
} }
} }
if (!foreground) {
do_detach();
}
tunnel(tun_fd, dns_fd); tunnel(tun_fd, dns_fd);
cleanup2: cleanup2:

View File

@ -536,10 +536,6 @@ main(int argc, char **argv)
do_chroot(newroot); do_chroot(newroot);
if (!foreground) {
do_detach();
}
signal(SIGINT, sigint); signal(SIGINT, sigint);
if (username) { if (username) {
if (setgid(pw->pw_gid) < 0 || setuid(pw->pw_uid) < 0) { if (setgid(pw->pw_gid) < 0 || setuid(pw->pw_uid) < 0) {
@ -548,6 +544,10 @@ main(int argc, char **argv)
} }
} }
if (!foreground) {
do_detach();
}
tunnel(tun_fd, dnsd_fd); tunnel(tun_fd, dnsd_fd);
cleanup2: cleanup2: