]> The Tcpdump Group git mirrors - tcpdump/blobdiff - tcpdump.c
Get rid of unused variables.
[tcpdump] / tcpdump.c
index 1a6f27519d494f976cf6542edf1f971107e68f3e..059d254671f9e253e35613b3de93d81a76f47b5c 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -30,7 +30,7 @@ static const char copyright[] =
     "@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000\n\
 The Regents of the University of California.  All rights reserved.\n";
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.206 2003-05-11 06:01:17 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.209 2003-06-03 23:32:42 guy Exp $ (LBL)";
 #endif
 
 /*
@@ -608,18 +608,24 @@ main(int argc, char **argv)
                thiszone = gmt2local(0);
 
        if (RFileName != NULL) {
+#ifndef WIN32
                /*
-                * We don't need network access, so set it back to the user id.
-                * Also, this prevents the user from reading anyone's
-                * trace file.
+                * We don't need network access, so relinquish any set-UID
+                * or set-GID privileges we have (if any).
+                *
+                * We do *not* want set-UID privileges when opening a
+                * trace file, as that might let the user read other
+                * people's trace files (especially if we're set-UID
+                * root).
                 */
-#ifndef WIN32
                setuid(getuid());
 #endif /* WIN32 */
-
                pd = pcap_open_offline(RFileName, ebuf);
                if (pd == NULL)
                        error("%s", ebuf);
+                printf("reading from file %s, link-type %u\n",
+                      RFileName,
+                      pcap_datalink(pd));
                localnet = 0;
                netmask = 0;
                if (fflag != 0)
@@ -745,8 +751,8 @@ main(int argc, char **argv)
                            program_name);
                } else
                        (void)fprintf(stderr, "%s: ", program_name);
-               (void)fprintf(stderr, "listening on %s, capture size %u bytes\n",
-                   device, snaplen);
+               (void)fprintf(stderr, "listening on %s, link-type %u, capture size %u bytes\n",
+                   device, pcap_datalink(pd), snaplen);
                (void)fflush(stderr);
        }
 #endif /* WIN32 */