diff options
author | Kozlov Dmitry <xeb@mail.ru> | 2012-01-13 12:38:26 +0400 |
---|---|---|
committer | Kozlov Dmitry <xeb@mail.ru> | 2012-01-13 12:38:26 +0400 |
commit | bf1ccc7f6e7a9dc5a8ba3d8d02b25ad446458840 (patch) | |
tree | 4e53a7f2990e40436f6ae98434f72c3db14434c0 /accel-pppd/radius/req.c | |
parent | 03a466f1b0f7549c2ef89c1e544c2c86c3958ad4 (diff) | |
download | accel-ppp-bf1ccc7f6e7a9dc5a8ba3d8d02b25ad446458840.tar.gz accel-ppp-bf1ccc7f6e7a9dc5a8ba3d8d02b25ad446458840.zip |
set FD_CLOEXEC on opened file descriptors
Diffstat (limited to 'accel-pppd/radius/req.c')
-rw-r--r-- | accel-pppd/radius/req.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/accel-pppd/radius/req.c b/accel-pppd/radius/req.c index 4a9d42ad..cc0b261a 100644 --- a/accel-pppd/radius/req.c +++ b/accel-pppd/radius/req.c @@ -14,8 +14,6 @@ #include "memdebug.h" -static int urandom_fd; - static int rad_req_read(struct triton_md_handler_t *h); static void rad_req_timeout(struct triton_timer_t *t); @@ -177,6 +175,8 @@ static int make_socket(struct rad_req_t *req) log_ppp_error("radius:socket: %s\n", strerror(errno)); return -1; } + + fcntl(req->hnd.fd, F_SETFD, fcntl(req->hnd.fd, F_GETFD) | FD_CLOEXEC); memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; @@ -298,11 +298,6 @@ int rad_req_wait(struct rad_req_t *req, int timeout) static void req_init(void) { - urandom_fd = open("/dev/urandom", O_RDONLY); - if (!urandom_fd) { - log_emerg("radius:req: open /dev/urandom: %s\n", strerror(errno)); - _exit(EXIT_FAILURE); - } } DEFINE_INIT(50, req_init); |