summaryrefslogtreecommitdiff
path: root/src/basic/random-util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/basic/random-util.c')
-rw-r--r--src/basic/random-util.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/basic/random-util.c b/src/basic/random-util.c
index d8734cc7d0..28ace92f19 100644
--- a/src/basic/random-util.c
+++ b/src/basic/random-util.c
@@ -75,7 +75,7 @@ static void fallback_random_bytes(void *p, size_t n) {
void random_bytes(void *p, size_t n) {
static bool have_getrandom = true, have_grndinsecure = true;
- _cleanup_close_ int fd = -1;
+ _cleanup_close_ int fd = -EBADF;
if (n == 0)
return;
@@ -117,7 +117,7 @@ void random_bytes(void *p, size_t n) {
int crypto_random_bytes(void *p, size_t n) {
static bool have_getrandom = true, seen_initialized = false;
- _cleanup_close_ int fd = -1;
+ _cleanup_close_ int fd = -EBADF;
if (n == 0)
return 0;
@@ -145,7 +145,7 @@ int crypto_random_bytes(void *p, size_t n) {
}
if (!seen_initialized) {
- _cleanup_close_ int ready_fd = -1;
+ _cleanup_close_ int ready_fd = -EBADF;
int r;
ready_fd = open("/dev/random", O_RDONLY|O_CLOEXEC|O_NOCTTY);
@@ -187,7 +187,7 @@ size_t random_pool_size(void) {
}
int random_write_entropy(int fd, const void *seed, size_t size, bool credit) {
- _cleanup_close_ int opened_fd = -1;
+ _cleanup_close_ int opened_fd = -EBADF;
int r;
assert(seed || size == 0);