summaryrefslogtreecommitdiffstats
path: root/lib/randutils.c
diff options
context:
space:
mode:
authorKarel Zak2013-04-03 16:13:06 +0200
committerKarel Zak2013-04-03 16:13:06 +0200
commitb1fa3e2234fab95960eaa8499384000f189def13 (patch)
tree0db13933f5db07cb90cc40ff736829c11ad43509 /lib/randutils.c
parentinclude/fileutils: use O_CLOEXEC for mktemp stuff (diff)
downloadkernel-qcow2-util-linux-b1fa3e2234fab95960eaa8499384000f189def13.tar.gz
kernel-qcow2-util-linux-b1fa3e2234fab95960eaa8499384000f189def13.tar.xz
kernel-qcow2-util-linux-b1fa3e2234fab95960eaa8499384000f189def13.zip
lib: use O_CLOEXEC in libcommon
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'lib/randutils.c')
-rw-r--r--lib/randutils.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/randutils.c b/lib/randutils.c
index 80893d3db..ed79aad92 100644
--- a/lib/randutils.c
+++ b/lib/randutils.c
@@ -34,9 +34,9 @@ int random_get_fd(void)
struct timeval tv;
gettimeofday(&tv, 0);
- fd = open("/dev/urandom", O_RDONLY);
+ fd = open("/dev/urandom", O_RDONLY | O_CLOEXEC);
if (fd == -1)
- fd = open("/dev/random", O_RDONLY | O_NONBLOCK);
+ fd = open("/dev/random", O_RDONLY | O_NONBLOCK | O_CLOEXEC);
if (fd >= 0) {
i = fcntl(fd, F_GETFD);
if (i >= 0)