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