diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-03-15 11:48:05 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-03-15 11:48:05 +0000 |
commit | 92325dffa62df45e62407cd360262228112ea0d1 (patch) | |
tree | 4b51a472cef0a2918471d73455d636fcb64ad6aa /usr.sbin/bgpd | |
parent | 0051e8494673309161f893e628c167b308fc7bc6 (diff) |
properly check chdir success after chroot() and tweak err msgs a little,
claudio ok
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r-- | usr.sbin/bgpd/rde.c | 7 | ||||
-rw-r--r-- | usr.sbin/bgpd/session.c | 7 |
2 files changed, 8 insertions, 6 deletions
diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c index 75cf1572da2..c4683327e6c 100644 --- a/usr.sbin/bgpd/rde.c +++ b/usr.sbin/bgpd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.99 2004/03/12 20:48:09 henning Exp $ */ +/* $OpenBSD: rde.c,v 1.100 2004/03/15 11:48:04 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -119,8 +119,9 @@ rde_main(struct bgpd_config *config, struct peer *peer_l, fatal("getpwnam"); if (chroot(pw->pw_dir) == -1) - fatal("chroot failed"); - chdir("/"); + fatal("chroot"); + if (chdir("/") == -1) + fatal("chdir(\"/\")"); setproctitle("route decision engine"); bgpd_process = PROC_RDE; diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c index ba46779859d..6f6d65546ae 100644 --- a/usr.sbin/bgpd/session.c +++ b/usr.sbin/bgpd/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.135 2004/03/12 19:33:30 henning Exp $ */ +/* $OpenBSD: session.c,v 1.136 2004/03/15 11:48:04 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -170,8 +170,9 @@ session_main(struct bgpd_config *config, struct peer *cpeers, fatal(NULL); if (chroot(pw->pw_dir) == -1) - fatal("chroot failed"); - chdir("/"); + fatal("chroot"); + if (chdir("/") == -1) + fatal("chdir(\"/\")"); setproctitle("session engine"); bgpd_process = PROC_SE; |