diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-14 02:23:43 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-14 02:23:43 +0000 |
commit | ea62077b850076c4d7dc3cf78ebd1888928c6ddf (patch) | |
tree | 37b7584ae40b99edb5583fbc4392b62ffdadf278 /networking/udhcp | |
parent | 88ca06769028e442bf873b270c176ca0e9f021f8 (diff) | |
download | busybox-ea62077b850076c4d7dc3cf78ebd1888928c6ddf.tar.gz |
add open_read_close() and similar stuff
Diffstat (limited to 'networking/udhcp')
-rw-r--r-- | networking/udhcp/arpping.c | 2 | ||||
-rw-r--r-- | networking/udhcp/clientpacket.c | 7 | ||||
-rw-r--r-- | networking/udhcp/options.c | 2 | ||||
-rw-r--r-- | networking/udhcp/signalpipe.c | 2 |
4 files changed, 5 insertions, 8 deletions
diff --git a/networking/udhcp/arpping.c b/networking/udhcp/arpping.c index 587339f9b..086692082 100644 --- a/networking/udhcp/arpping.c +++ b/networking/udhcp/arpping.c @@ -49,7 +49,7 @@ int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *mac, char *interface) } if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &optval, sizeof(optval)) == -1) { - bb_perror_msg("Could not setsocketopt on raw socket"); + bb_perror_msg("cannot setsocketopt on raw socket"); close(s); return -1; } diff --git a/networking/udhcp/clientpacket.c b/networking/udhcp/clientpacket.c index f9f5a3b8c..439aa0250 100644 --- a/networking/udhcp/clientpacket.c +++ b/networking/udhcp/clientpacket.c @@ -39,16 +39,13 @@ unsigned long random_xid(void) { static int initialized; if (!initialized) { - int fd; unsigned long seed; - fd = open("/dev/urandom", 0); - if (fd < 0 || read(fd, &seed, sizeof(seed)) < 0) { - bb_info_msg("Could not load seed " + if (open_read_close("/dev/urandom", &seed, sizeof(seed)) < 0) { + bb_info_msg("Cannot load seed " "from /dev/urandom: %s", strerror(errno)); seed = time(0); } - if (fd >= 0) close(fd); srand(seed); initialized++; } diff --git a/networking/udhcp/options.c b/networking/udhcp/options.c index ded0f7b9b..8dba2ef69 100644 --- a/networking/udhcp/options.c +++ b/networking/udhcp/options.c @@ -171,6 +171,6 @@ int add_simple_option(uint8_t *optionptr, uint8_t code, uint32_t data) } } - bb_error_msg("Could not add option 0x%02x", code); + bb_error_msg("cannot add option 0x%02x", code); return 0; } diff --git a/networking/udhcp/signalpipe.c b/networking/udhcp/signalpipe.c index 6c4a9f1f2..bece4193a 100644 --- a/networking/udhcp/signalpipe.c +++ b/networking/udhcp/signalpipe.c @@ -36,7 +36,7 @@ static int signal_pipe[2]; static void signal_handler(int sig) { if (send(signal_pipe[1], &sig, sizeof(sig), MSG_DONTWAIT) < 0) - bb_perror_msg("Could not send signal"); + bb_perror_msg("cannot send signal"); } |