diff options
author | 2013-06-04 00:45:00 +0000 | |
---|---|---|
committer | 2013-06-04 00:45:00 +0000 | |
commit | 1b8ec09c2291c00ab9700433124fe977d2df2f91 (patch) | |
tree | 2e282e7b99dce58a83bd5f1ecf7b5c5912da10a0 | |
parent | supress errors that would occur if bioctl is missing or is run with an (diff) | |
download | wireguard-openbsd-1b8ec09c2291c00ab9700433124fe977d2df2f91.tar.xz wireguard-openbsd-1b8ec09c2291c00ab9700433124fe977d2df2f91.zip |
Minor adjustments in the startup of the lde and ldpe processes
The 'ldpd_process' variable should be set as soon as possible in the
initialization of each process. In that way if something goes wrong in
the initialization we will know in which process the problem happened.
Diff by Renato Westphal
-rw-r--r-- | usr.sbin/ldpd/lde.c | 8 | ||||
-rw-r--r-- | usr.sbin/ldpd/ldpe.c | 12 |
2 files changed, 10 insertions, 10 deletions
diff --git a/usr.sbin/ldpd/lde.c b/usr.sbin/ldpd/lde.c index 6c483b47646..0a3591d9381 100644 --- a/usr.sbin/ldpd/lde.c +++ b/usr.sbin/ldpd/lde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lde.c,v 1.23 2013/06/03 17:01:59 claudio Exp $ */ +/* $OpenBSD: lde.c,v 1.24 2013/06/04 00:45:00 claudio Exp $ */ /* * Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org> @@ -96,6 +96,9 @@ lde(struct ldpd_conf *xconf, int pipe_parent2lde[2], int pipe_ldpe2lde[2], ldeconf = xconf; + setproctitle("label decision engine"); + ldpd_process = PROC_LDE_ENGINE; + if ((pw = getpwnam(LDPD_USER)) == NULL) fatal("getpwnam"); @@ -104,9 +107,6 @@ lde(struct ldpd_conf *xconf, int pipe_parent2lde[2], int pipe_ldpe2lde[2], if (chdir("/") == -1) fatal("chdir(\"/\")"); - setproctitle("label decision engine"); - ldpd_process = PROC_LDE_ENGINE; - if (setgroups(1, &pw->pw_gid) || setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) || setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid)) diff --git a/usr.sbin/ldpd/ldpe.c b/usr.sbin/ldpd/ldpe.c index cbe58cf5dd0..a461db7dbb4 100644 --- a/usr.sbin/ldpd/ldpe.c +++ b/usr.sbin/ldpd/ldpe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ldpe.c,v 1.19 2013/06/04 00:41:18 claudio Exp $ */ +/* $OpenBSD: ldpe.c,v 1.20 2013/06/04 00:45:00 claudio Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -87,6 +87,11 @@ ldpe(struct ldpd_conf *xconf, int pipe_parent2ldpe[2], int pipe_ldpe2lde[2], return (pid); } + leconf = xconf; + + setproctitle("ldp engine"); + ldpd_process = PROC_LDP_ENGINE; + /* create ldpd control socket outside chroot */ if (control_init() == -1) fatalx("control socket setup failed"); @@ -142,8 +147,6 @@ ldpe(struct ldpd_conf *xconf, int pipe_parent2ldpe[2], int pipe_ldpe2lde[2], fatal("if_set_tos"); session_socket_blockmode(xconf->ldp_session_socket, BM_NONBLOCK); - leconf = xconf; - if ((pw = getpwnam(LDPD_USER)) == NULL) fatal("getpwnam"); @@ -152,9 +155,6 @@ ldpe(struct ldpd_conf *xconf, int pipe_parent2ldpe[2], int pipe_ldpe2lde[2], if (chdir("/") == -1) fatal("chdir(\"/\")"); - setproctitle("ldp engine"); - ldpd_process = PROC_LDP_ENGINE; - if (setgroups(1, &pw->pw_gid) || setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) || setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid)) |