summaryrefslogtreecommitdiff
path: root/sbin/ping/ping.c
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2014-01-10 21:57:45 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2014-01-10 21:57:45 +0000
commitba3fcfea6d05eab3dc1bd3170045030f77497b73 (patch)
treeceea7d972d426ab3f046dacca7a1ab3c6d7c2b7d /sbin/ping/ping.c
parent8495f0fc275d6a454a466ed4c55000ab8729b1b1 (diff)
Fix the unitialized rtableid bug discovered and fixed in the previous
commit by brad@ by calling setsockopt SO_RTABLE only when -V is present. As a bonus drop privileges very early in main, before option parsing. This brings ping6 more in line with what ping does and will make eventual unification easier. OK deraadt@ "works for me" brad@
Diffstat (limited to 'sbin/ping/ping.c')
-rw-r--r--sbin/ping/ping.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
index 2cc843ed556..6170e7e83de 100644
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ping.c,v 1.98 2014/01/10 06:18:40 brad Exp $ */
+/* $OpenBSD: ping.c,v 1.99 2014/01/10 21:57:44 florian Exp $ */
/* $NetBSD: ping.c,v 1.20 1995/08/11 22:37:58 cgd Exp $ */
/*
@@ -190,7 +190,7 @@ main(int argc, char *argv[])
fd_set *fdmaskp;
size_t fdmasks;
uid_t uid;
- int rtableid = -1;
+ u_int rtableid;
if ((s = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP)) < 0)
err(1, "socket");