]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
errno-util: let's beef up ERRNO_IS_NOT_SUPPORTED() with socket not supported errors 15444/head
authorLennart Poettering <lennart@poettering.net>
Thu, 16 Apr 2020 10:09:48 +0000 (12:09 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 17 Apr 2020 14:05:56 +0000 (16:05 +0200)
src/basic/errno-util.h
src/journal/journald-audit.c

index 65a6384eeb0457013ff6bb2306d51b49da4eec4a..0ca650f48f6d957291e9c0694c495d481f00ff52 100644 (file)
@@ -87,12 +87,16 @@ static inline bool ERRNO_IS_RESOURCE(int r) {
                       ENOMEM);
 }
 
-/* Three different errors for "operation/system call/ioctl not supported" */
+/* Seven different errors for "operation/system call/ioctl/socket feature not supported" */
 static inline bool ERRNO_IS_NOT_SUPPORTED(int r) {
         return IN_SET(abs(r),
                       EOPNOTSUPP,
                       ENOTTY,
-                      ENOSYS);
+                      ENOSYS,
+                      EAFNOSUPPORT,
+                      EPFNOSUPPORT,
+                      EPROTONOSUPPORT,
+                      ESOCKTNOSUPPORT);
 }
 
 /* Two different errors for access problems */
index 5c31c43705b586869513f0d2b282513727e77e93..a5a78b7746948cdc23c108ea6f63e40371c4d34a 100644 (file)
@@ -2,6 +2,7 @@
 
 #include "alloc-util.h"
 #include "audit-type.h"
+#include "errno-util.h"
 #include "fd-util.h"
 #include "hexdecoct.h"
 #include "io-util.h"
@@ -512,7 +513,7 @@ int server_open_audit(Server *s) {
 
                 s->audit_fd = socket(AF_NETLINK, SOCK_RAW|SOCK_CLOEXEC|SOCK_NONBLOCK, NETLINK_AUDIT);
                 if (s->audit_fd < 0) {
-                        if (IN_SET(errno, EAFNOSUPPORT, EPROTONOSUPPORT))
+                        if (ERRNO_IS_NOT_SUPPORTED(errno))
                                 log_debug("Audit not supported in the kernel.");
                         else
                                 log_warning_errno(errno, "Failed to create audit socket, ignoring: %m");