summaryrefslogtreecommitdiffstats
path: root/usr.sbin/tcpdump/tcpdump.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2006-04-17 23:49:59 +0000
committerderaadt <deraadt@openbsd.org>2006-04-17 23:49:59 +0000
commita4d1fe40210e708bfa45c3b6b29806deea95dd56 (patch)
tree8de89a0f8110f08238768a7a30d1527fce80ba25 /usr.sbin/tcpdump/tcpdump.c
parentRemove unused struct mdproc fields. (diff)
downloadwireguard-openbsd-a4d1fe40210e708bfa45c3b6b29806deea95dd56.tar.xz
wireguard-openbsd-a4d1fe40210e708bfa45c3b6b29806deea95dd56.zip
initialize program_name before we privsep, otherwise the child does not
know our name
Diffstat (limited to 'usr.sbin/tcpdump/tcpdump.c')
-rw-r--r--usr.sbin/tcpdump/tcpdump.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/usr.sbin/tcpdump/tcpdump.c b/usr.sbin/tcpdump/tcpdump.c
index 6e7729c1f38..03fe4b575a9 100644
--- a/usr.sbin/tcpdump/tcpdump.c
+++ b/usr.sbin/tcpdump/tcpdump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcpdump.c,v 1.50 2006/03/13 19:05:56 moritz Exp $ */
+/* $OpenBSD: tcpdump.c,v 1.51 2006/04/17 23:49:59 deraadt Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -26,7 +26,7 @@ static const char copyright[] =
"@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997\n\
The Regents of the University of California. All rights reserved.\n";
static const char rcsid[] =
- "@(#) $Header: /home/cvs/src/usr.sbin/tcpdump/tcpdump.c,v 1.50 2006/03/13 19:05:56 moritz Exp $ (LBL)";
+ "@(#) $Header: /home/cvs/src/usr.sbin/tcpdump/tcpdump.c,v 1.51 2006/04/17 23:49:59 deraadt Exp $ (LBL)";
#endif
/*
@@ -213,31 +213,25 @@ extern char *optarg;
int
main(int argc, char **argv)
{
- register int cnt, op, i;
+ int cnt = -1, op, i;
bpf_u_int32 localnet, netmask;
- register char *cp, *infile, *device, *RFileName, *WFileName;
+ char *cp, *infile = NULL, *device = NULL, *RFileName = NULL;
+ char ebuf[PCAP_ERRBUF_SIZE], *WFileName = NULL;
pcap_handler printer;
struct bpf_program *fcode;
RETSIGTYPE (*oldhandler)(int);
u_char *pcap_userdata;
- char ebuf[PCAP_ERRBUF_SIZE];
u_int dlt = (u_int) -1;
- cnt = -1;
- device = NULL;
- infile = NULL;
- RFileName = NULL;
- WFileName = NULL;
-
- if (priv_init(argc, argv))
- error("Failed to setup privsep");
-
/* state: STATE_INIT */
if ((cp = strrchr(argv[0], '/')) != NULL)
program_name = cp + 1;
else
program_name = argv[0];
+ if (priv_init(argc, argv))
+ error("Failed to setup privsep");
+
if (abort_on_misalignment(ebuf, sizeof(ebuf)) < 0)
error("%s", ebuf);