]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fd-util: beef up ERRNO_IS_xyz() macros a bit
authorLennart Poettering <lennart@poettering.net>
Tue, 19 Mar 2019 11:56:25 +0000 (12:56 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 19 Mar 2019 14:29:44 +0000 (15:29 +0100)
Let's implicit drop the negation if there is one, to simplify things a
bit, similar how we do it in log_xyz()...

src/basic/fd-util.h

index 4085a244d2b6a82703dd47301300954f360a5d56..8c3daf62a8278e83773c2b6f4b301f7875bcb4b4 100644 (file)
@@ -81,13 +81,13 @@ int fd_duplicate_data_fd(int fd);
 /* The kernel sends e.g., EHOSTUNREACH or ENONET to userspace in some ICMP error cases.
  * See the icmp_err_convert[] in net/ipv4/icmp.c in the kernel sources */
 #define ERRNO_IS_DISCONNECT(r)                                          \
-        IN_SET(r,                                                       \
+        IN_SET(abs(r),                                                  \
                ENOTCONN, ECONNRESET, ECONNREFUSED, ECONNABORTED, EPIPE, \
                ENETUNREACH, EHOSTUNREACH, ENOPROTOOPT, EHOSTDOWN, ENONET)
 
 /* Resource exhaustion, could be our fault or general system trouble */
 #define ERRNO_IS_RESOURCE(r) \
-        IN_SET(r, ENOMEM, EMFILE, ENFILE)
+        IN_SET(abs(r), ENOMEM, EMFILE, ENFILE)
 
 int fd_move_above_stdio(int fd);