Changeset 1770 in MondoRescue for branches/stable/mindi-busybox/libbb/create_icmp_socket.c
- Timestamp:
- Nov 6, 2007, 11:01:53 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mindi-busybox/libbb/create_icmp_socket.c
r821 r1770 8 8 */ 9 9 10 #include <sys/types.h> 11 #include <netdb.h> 12 #include <sys/socket.h> 13 #include <errno.h> 14 #include <unistd.h> 10 //#include <sys/types.h> 11 //#include <netdb.h> 12 //#include <sys/socket.h> 15 13 #include "libbb.h" 16 14 … … 23 21 /* if getprotobyname failed, just silently force 24 22 * proto->p_proto to have the correct value for "icmp" */ 25 if ((sock = socket(AF_INET, SOCK_RAW, 26 (proto ? proto->p_proto : 1))) < 0) { /* 1 == ICMP */ 23 sock = socket(AF_INET, SOCK_RAW, 24 (proto ? proto->p_proto : 1)); /* 1 == ICMP */ 25 if (sock < 0) { 27 26 if (errno == EPERM) 28 27 bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); 29 else 30 bb_perror_msg_and_die(bb_msg_can_not_create_raw_socket); 28 bb_perror_msg_and_die(bb_msg_can_not_create_raw_socket); 31 29 } 32 30 33 31 /* drop root privs if running setuid */ 34 setuid(getuid());32 xsetuid(getuid()); 35 33 36 34 return sock;
Note:
See TracChangeset
for help on using the changeset viewer.