From: Lennart Poettering Date: Wed, 10 Apr 2019 17:38:37 +0000 (+0200) Subject: errno-util: add three more error codes to ERRNO_IS_DISCONNECT() X-Git-Tag: v242~5^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=916a9ec7c6ad0e58a44457f9ea832f16350f5b74;p=thirdparty%2Fsystemd.git errno-util: add three more error codes to ERRNO_IS_DISCONNECT() This is based on the recommendations in accept4() and the listed error codes there. --- diff --git a/src/basic/errno-util.h b/src/basic/errno-util.h index 615b6a806a8..f2677c7c19c 100644 --- a/src/basic/errno-util.h +++ b/src/basic/errno-util.h @@ -32,11 +32,23 @@ static inline int negative_errno(void) { * * Hint #2: 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(abs(r), \ - ENOTCONN, ECONNRESET, ECONNREFUSED, ECONNABORTED, EPIPE, \ - ENETUNREACH, EHOSTUNREACH, ENOPROTOOPT, EHOSTDOWN, \ - ENONET, ESHUTDOWN) +static inline bool ERRNO_IS_DISCONNECT(int r) { + return IN_SET(abs(r), + ECONNABORTED, + ECONNREFUSED, + ECONNRESET, + EHOSTDOWN, + EHOSTUNREACH, + ENETDOWN, + ENETRESET, + ENETUNREACH, + ENONET, + ENOPROTOOPT, + ENOTCONN, + EPIPE, + EPROTO, + ESHUTDOWN); +} /* Resource exhaustion, could be our fault or general system trouble */ #define ERRNO_IS_RESOURCE(r) \