lib/randutils: drop unnecessary fcntl() in random_get_fd()
We already pass O_CLOEXEC flag to open(), no need to modify
the file descriptor with FD_CLOEXEC afterwards.
This was a left over from commit b1fa3e2234
('lib: use O_CLOEXEC in
libcommon').
Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
parent
d5c515dc72
commit
261888f158
1 changed files with 1 additions and 6 deletions
|
@ -80,16 +80,11 @@ static void crank_random(void)
|
|||
|
||||
int random_get_fd(void)
|
||||
{
|
||||
int i, fd;
|
||||
int fd;
|
||||
|
||||
fd = open("/dev/urandom", O_RDONLY | O_CLOEXEC);
|
||||
if (fd == -1)
|
||||
fd = open("/dev/random", O_RDONLY | O_NONBLOCK | O_CLOEXEC);
|
||||
if (fd >= 0) {
|
||||
i = fcntl(fd, F_GETFD);
|
||||
if (i >= 0)
|
||||
fcntl(fd, F_SETFD, i | FD_CLOEXEC);
|
||||
}
|
||||
crank_random();
|
||||
return fd;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue