]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
random-util: use ERRNO_IS_NOT_SUPPORTED() macro
authorLennart Poettering <lennart@poettering.net>
Sun, 10 May 2020 09:14:10 +0000 (11:14 +0200)
committerLennart Poettering <lennart@poettering.net>
Sun, 10 May 2020 09:14:17 +0000 (11:14 +0200)
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

index 363a1f71513c1189cce65f4e2008633e6be8cc68..c32e6e2aac92f137df07038f0233a64de52a277c 100644 (file)
@@ -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;