errno-util: add ERRNO_IS_PRIVILEGE() helper
authorLennart Poettering <lennart@poettering.net>
Wed, 20 Nov 2019 11:22:40 +0000 (12:22 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 20 Nov 2019 11:29:54 +0000 (12:29 +0100)
src/basic/errno-util.h

index b2723b8..8f1be6c 100644 (file)
@@ -94,3 +94,10 @@ static inline bool ERRNO_IS_NOT_SUPPORTED(int r) {
                       ENOTTY,
                       ENOSYS);
 }
+
+/* Two different errors for access problems */
+static inline bool ERRNO_IS_PRIVILEGE(int r) {
+        return IN_SET(abs(r),
+                      EACCES,
+                      EPERM);
+}