From: Lennart Poettering Date: Tue, 19 Mar 2019 11:56:25 +0000 (+0100) Subject: fd-util: beef up ERRNO_IS_xyz() macros a bit X-Git-Tag: v242-rc1~106^2~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=594da0a3e140b1801b5f85d2be930db834d1e9cc;p=thirdparty%2Fsystemd.git fd-util: beef up ERRNO_IS_xyz() macros a bit Let's implicit drop the negation if there is one, to simplify things a bit, similar how we do it in log_xyz()... --- diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h index 4085a244d2b..8c3daf62a82 100644 --- a/src/basic/fd-util.h +++ b/src/basic/fd-util.h @@ -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);