From: Lennart Poettering Date: Sun, 10 May 2020 09:14:10 +0000 (+0200) Subject: random-util: use ERRNO_IS_NOT_SUPPORTED() macro X-Git-Tag: v246-rc1~393^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e2b55464523adbb3732eb632ac2a21b685935642;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/basic/random-util.c b/src/basic/random-util.c index 363a1f71513..c32e6e2aac9 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;