summaryrefslogtreecommitdiff
path: root/lib/getrandom.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/getrandom.c')
-rw-r--r--lib/getrandom.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/getrandom.c b/lib/getrandom.c
index b467caa7a..a186c4d3b 100644
--- a/lib/getrandom.c
+++ b/lib/getrandom.c
@@ -2,12 +2,12 @@
Copyright 2020-2021 Free Software Foundation, Inc.
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
+ This file is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
+ This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
@@ -178,7 +178,11 @@ getrandom (void *buffer, size_t length, unsigned int flags)
+ (flags & GRND_NONBLOCK ? O_NONBLOCK : 0));
fd = open (randdevice[devrandom], oflags);
if (fd < 0)
- return fd;
+ {
+ if (errno == ENOENT || errno == ENOTDIR)
+ errno = ENOSYS;
+ return -1;
+ }
randfd[devrandom] = fd;
}