From e2b55464523adbb3732eb632ac2a21b685935642 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 10 May 2020 11:14:10 +0200 Subject: [PATCH] random-util: use ERRNO_IS_NOT_SUPPORTED() macro Some container mgr or sandbox solution might block it with an unexpected error code, hence let's be tolerant here. --- src/basic/random-util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/basic/random-util.c b/src/basic/random-util.c index 363a1f7151..c32e6e2aac 100644 --- a/src/basic/random-util.c +++ b/src/basic/random-util.c @@ -19,6 +19,7 @@ #endif #include "alloc-util.h" +#include "errno-util.h" #include "fd-util.h" #include "fileio.h" #include "io-util.h" @@ -237,7 +238,7 @@ int genuine_random_bytes(void *p, size_t n, RandomFlags flags) { have_syscall = true; return -EIO; - } else if (errno == ENOSYS) { + } else if (ERRNO_IS_NOT_SUPPORTED(errno)) { /* We lack the syscall, continue with reading from /dev/urandom. */ have_syscall = false; break;