summaryrefslogtreecommitdiff
path: root/usr.sbin/tcpdump
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2004-03-14 19:17:06 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2004-03-14 19:17:06 +0000
commit89d99c0284f993829fecf7c794a4e503c08ee5c5 (patch)
treedcb5c7a99e1f49c1bd52284f9d3b003a5652a300 /usr.sbin/tcpdump
parentdc6eb02a705bb48a5ff401ae332781dec60bba96 (diff)
Check return code of chdir() after chroot(); noted by Joris Vink, slight mod
from avsm@. ok avsm@ hshoexer@ henning@
Diffstat (limited to 'usr.sbin/tcpdump')
-rw-r--r--usr.sbin/tcpdump/privsep.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/tcpdump/privsep.c b/usr.sbin/tcpdump/privsep.c
index fc0c6cdfc59..feed7d69d5f 100644
--- a/usr.sbin/tcpdump/privsep.c
+++ b/usr.sbin/tcpdump/privsep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: privsep.c,v 1.4 2004/02/05 22:12:06 otto Exp $ */
+/* $OpenBSD: privsep.c,v 1.5 2004/03/14 19:17:05 otto Exp $ */
/*
* Copyright (c) 2003 Can Erkin Acar
@@ -128,7 +128,8 @@ priv_init(int argc, char **argv)
/* chroot, drop privs and return */
if (chroot(pw->pw_dir) != 0)
err(1, "unable to chroot");
- chdir("/");
+ if (chdir("/") != 0)
+ err(1, "unable to chdir");
/* drop to _tcpdump */
if (setgroups(1, &pw->pw_gid) == -1)