401f5d4
--- tcpdump-3.9.7/tcpdump.c.droproot	2006-09-19 21:07:57.000000000 +0200
401f5d4
+++ tcpdump-3.9.7/tcpdump.c	2007-07-24 16:15:54.000000000 +0200
401f5d4
@@ -958,6 +958,11 @@ main(int argc, char **argv)
401f5d4
 		(void)setsignal(SIGHUP, oldhandler);
401f5d4
 #endif /* WIN32 */
401f5d4
 
401f5d4
+	if (Cflag != 0 && (getuid() == 0 || geteuid() == 0)) {
401f5d4
+		if (username || chroot_dir)
401f5d4
+			droproot(username, chroot_dir);
401f5d4
+	}
401f5d4
+
401f5d4
 	if (pcap_setfilter(pd, &fcode) < 0)
401f5d4
 		error("%s", pcap_geterr(pd));
401f5d4
 	if (WFileName) {
401f5d4
@@ -999,7 +1004,7 @@ main(int argc, char **argv)
401f5d4
 	 * We cannot do this earlier, because we want to be able to open
401f5d4
 	 * the file (if done) for writing before giving up permissions.
401f5d4
 	 */
401f5d4
-	if (getuid() == 0 || geteuid() == 0) {
401f5d4
+	if (Cflag == 0 && (getuid() == 0 || geteuid() == 0)) {
401f5d4
 		if (username || chroot_dir)
401f5d4
 			droproot(username, chroot_dir);
401f5d4
 	}
401f5d4
--- tcpdump-3.9.7/tcpdump.1.droproot	2007-07-24 16:15:54.000000000 +0200
401f5d4
+++ tcpdump-3.9.7/tcpdump.1	2007-07-24 16:15:54.000000000 +0200
401f5d4
@@ -264,6 +264,9 @@ have the name specified with the
401f5d4
 flag, with a number after it, starting at 1 and continuing upward.
401f5d4
 The units of \fIfile_size\fP are millions of bytes (1,000,000 bytes,
401f5d4
 not 1,048,576 bytes).
401f5d4
+
401f5d4
+Note that when used with \fB\-Z\fR option (enabled by default), privileges
401f5d4
+are dropped before opening first savefile.
401f5d4
 .TP
401f5d4
 .B \-d
401f5d4
 Dump the compiled packet-matching code in a human readable form to
401f5d4
@@ -592,7 +595,9 @@ Drops privileges (if root) and changes u
401f5d4
 and the group ID to the primary group of
401f5d4
 .IR user .
401f5d4
 .IP
401f5d4
-This behavior can also be enabled by default at compile time.
401f5d4
+This behavior is enabled by default (\fB\-Z pcap\fR), and can
401f5d4
+be disabled by \fB\-Z root\fR.
401f5d4
+
401f5d4
 .IP "\fI expression\fP"
401f5d4
 .RS
401f5d4
 selects which packets will be dumped.