summaryrefslogtreecommitdiff
path: root/networking/ether-wake.c
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-04-12 17:55:51 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-04-12 17:55:51 +0000
commitdac7ff15b7d32deeeef3d9665744fc5774c21d70 (patch)
tree0e4c34863628d79fdad0c6217f4deb0ca0a91c33 /networking/ether-wake.c
parent79865bc5077cf6d17b27e9599921d4c85b1575fd (diff)
downloadbusybox-w32-dac7ff15b7d32deeeef3d9665744fc5774c21d70.tar.gz
busybox-w32-dac7ff15b7d32deeeef3d9665744fc5774c21d70.tar.bz2
busybox-w32-dac7ff15b7d32deeeef3d9665744fc5774c21d70.zip
- patch from Denis Vlasenko to add and use bb_xsocket() and to use
bb_xopen some more while at it. Also use shorter boilerplate while at it.
Diffstat (limited to 'networking/ether-wake.c')
-rw-r--r--networking/ether-wake.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/networking/ether-wake.c b/networking/ether-wake.c
index 7d5f79b6a..b4fb0c2d1 100644
--- a/networking/ether-wake.c
+++ b/networking/ether-wake.c
@@ -1,10 +1,8 @@
1/* vi: set sw=4 ts=4: */
1/* 2/*
2 * ether-wake.c - Send a magic packet to wake up sleeping machines. 3 * ether-wake.c - Send a magic packet to wake up sleeping machines.
3 * 4 *
4 * This program is free software; you can redistribute it and/or 5 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 * 6 *
9 * Author: Donald Becker, http://www.scyld.com/"; http://www.scyld.com/wakeonlan.html 7 * Author: Donald Becker, http://www.scyld.com/"; http://www.scyld.com/wakeonlan.html
10 * Busybox port: Christian Volkmann <haveaniceday@online.de> 8 * Busybox port: Christian Volkmann <haveaniceday@online.de>
@@ -95,10 +93,10 @@
95 */ 93 */
96#ifdef PF_PACKET 94#ifdef PF_PACKET
97# define whereto_t sockaddr_ll 95# define whereto_t sockaddr_ll
98# define make_socket() socket(PF_PACKET, SOCK_RAW, 0) 96# define make_socket() bb_xsocket(PF_PACKET, SOCK_RAW, 0)
99#else 97#else
100# define whereto_t sockaddr 98# define whereto_t sockaddr
101# define make_socket() socket(AF_INET, SOCK_PACKET, SOCK_PACKET) 99# define make_socket() bb_xsocket(AF_INET, SOCK_PACKET, SOCK_PACKET)
102#endif 100#endif
103 101
104#ifdef DEBUG 102#ifdef DEBUG
@@ -145,8 +143,6 @@ int etherwake_main(int argc, char *argv[])
145 143
146 /* create the raw socket */ 144 /* create the raw socket */
147 s = make_socket(); 145 s = make_socket();
148 if (s < 0)
149 bb_perror_msg_and_die(bb_msg_can_not_create_raw_socket);
150 146
151 /* now that we have a raw socket we can drop root */ 147 /* now that we have a raw socket we can drop root */
152 setuid(getuid()); 148 setuid(getuid());