summaryrefslogtreecommitdiffhomepage
path: root/networking/udhcp/clientpacket.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/udhcp/clientpacket.c')
-rw-r--r--networking/udhcp/clientpacket.c7
1 files changed, 2 insertions, 5 deletions
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++;
}