summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2013-02-12 09:54:05 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2013-02-12 09:54:05 +0100
commit0dc634395d61b72483c13a896fdb5e82bc84821e (patch)
treea5d9f673d493153494306ab1b3b1a96bcdbc39c5
parent6c89cfe06b2a7c6a741865683f7fdfd80b1aebc0 (diff)
downloadgnutls-0dc634395d61b72483c13a896fdb5e82bc84821e.tar.gz
properly set close-on-exec.
-rw-r--r--lib/nettle/rnd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/nettle/rnd.c b/lib/nettle/rnd.c
index b2883ee3e4..0a5967104c 100644
--- a/lib/nettle/rnd.c
+++ b/lib/nettle/rnd.c
@@ -229,7 +229,8 @@ do_device_source_urandom (int init)
}
old = fcntl (device_fd, F_GETFD);
- fcntl (device_fd, F_SETFD, old | 1);
+ if (old != -1)
+ fcntl (device_fd, F_SETFD, old | FD_CLOEXEC);
memcpy(&device_last_read, &current_time, sizeof(device_last_read));
read_size = DEVICE_READ_SIZE_MAX; /* initially read more data */