ping.c (237942) | ping.c (241852) |
---|---|
1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Mike Muuss. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 28 unchanged lines hidden (view full) --- 37 The Regents of the University of California. All rights reserved.\n"; 38#endif /* not lint */ 39 40#ifndef lint 41static char sccsid[] = "@(#)ping.c 8.1 (Berkeley) 6/5/93"; 42#endif /* not lint */ 43#endif 44#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Mike Muuss. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 28 unchanged lines hidden (view full) --- 37 The Regents of the University of California. All rights reserved.\n"; 38#endif /* not lint */ 39 40#ifndef lint 41static char sccsid[] = "@(#)ping.c 8.1 (Berkeley) 6/5/93"; 42#endif /* not lint */ 43#endif 44#include <sys/cdefs.h> |
45__FBSDID("$FreeBSD: head/sbin/ping/ping.c 237942 2012-07-02 02:38:27Z delphij $"); | 45__FBSDID("$FreeBSD: head/sbin/ping/ping.c 241852 2012-10-22 03:31:22Z eadler $"); |
46 47/* 48 * P I N G . C 49 * 50 * Using the Internet Control Message Protocol (ICMP) "ECHO" facility, 51 * measure round-trip-delays and packet loss across network paths. 52 * 53 * Author - --- 196 unchanged lines hidden (view full) --- 250 /* 251 * Do the stuff that we need root priv's for *first*, and 252 * then drop our setuid bit. Save error reporting for 253 * after arg parsing. 254 */ 255 s = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP); 256 sockerrno = errno; 257 | 46 47/* 48 * P I N G . C 49 * 50 * Using the Internet Control Message Protocol (ICMP) "ECHO" facility, 51 * measure round-trip-delays and packet loss across network paths. 52 * 53 * Author - --- 196 unchanged lines hidden (view full) --- 250 /* 251 * Do the stuff that we need root priv's for *first*, and 252 * then drop our setuid bit. Save error reporting for 253 * after arg parsing. 254 */ 255 s = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP); 256 sockerrno = errno; 257 |
258 setuid(getuid()); | 258 if (setuid(getuid()) != 0) 259 err(EX_NOPERM, "setuid() failed"); |
259 uid = getuid(); 260 261 alarmtimeout = df = preload = tos = 0; 262 263 outpack = outpackhdr + sizeof(struct ip); 264 while ((ch = getopt(argc, argv, 265 "Aac:DdfG:g:h:I:i:Ll:M:m:nop:QqRrS:s:T:t:vW:z:" 266#ifdef IPSEC --- 1437 unchanged lines hidden --- | 260 uid = getuid(); 261 262 alarmtimeout = df = preload = tos = 0; 263 264 outpack = outpackhdr + sizeof(struct ip); 265 while ((ch = getopt(argc, argv, 266 "Aac:DdfG:g:h:I:i:Ll:M:m:nop:QqRrS:s:T:t:vW:z:" 267#ifdef IPSEC --- 1437 unchanged lines hidden --- |