]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: use ERRNO_IS_TRANSIENT()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 29 Nov 2021 19:07:24 +0000 (04:07 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 30 Nov 2021 14:06:43 +0000 (23:06 +0900)
26 files changed:
src/basic/terminal-util.c
src/core/cgroup.c
src/core/manager.c
src/core/path.c
src/home/homed-manager.c
src/import/importd.c
src/journal/journald-kmsg.c
src/journal/journald-server.c
src/journal/journald-stream.c
src/libsystemd-network/sd-dhcp-client.c
src/libsystemd-network/sd-dhcp-server.c
src/libsystemd-network/sd-dhcp6-client.c
src/libsystemd-network/sd-ipv4acd.c
src/libsystemd-network/sd-lldp-rx.c
src/libsystemd/sd-event/sd-event.c
src/libsystemd/sd-journal/sd-journal.c
src/libsystemd/sd-netlink/netlink-socket.c
src/libsystemd/sd-network/sd-network.c
src/nspawn/nspawn.c
src/resolve/resolved-dns-stream.c
src/resolve/resolved-manager.c
src/shared/ask-password-api.c
src/shared/barrier.c
src/socket-proxy/socket-proxyd.c
src/timesync/wait-sync.c
src/udev/udevd.c

index 8ef354ee9aca565193f2799550fa5210291468d9..79bb33df847c78fe823aa7b1dc56f3b2649d80c2 100644 (file)
@@ -453,7 +453,7 @@ int acquire_terminal(
 
                         l = read(notify, &buffer, sizeof(buffer));
                         if (l < 0) {
-                                if (IN_SET(errno, EINTR, EAGAIN))
+                                if (ERRNO_IS_TRANSIENT(errno))
                                         continue;
 
                                 return -errno;
index c942db8d05ebd80d47025a6629bbe586455d5069..396de12c4f0d3ceb37361e198566595739399574 100644 (file)
@@ -3191,7 +3191,7 @@ static int on_cgroup_inotify_event(sd_event_source *s, int fd, uint32_t revents,
 
                 l = read(fd, &buffer, sizeof(buffer));
                 if (l < 0) {
-                        if (IN_SET(errno, EINTR, EAGAIN))
+                        if (ERRNO_IS_TRANSIENT(errno))
                                 return 0;
 
                         return log_error_errno(errno, "Failed to read control group inotify events: %m");
index c94f032cc05ec26712f04f74c9722add836feb4f..780b15391309aeaf700399e6858f9d7894e035ad 100644 (file)
@@ -2445,18 +2445,19 @@ static int manager_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t
         }
 
         n = recvmsg_safe(m->notify_fd, &msghdr, MSG_DONTWAIT|MSG_CMSG_CLOEXEC|MSG_TRUNC);
-        if (IN_SET(n, -EAGAIN, -EINTR))
-                return 0; /* Spurious wakeup, try again */
-        if (n == -EXFULL) {
-                log_warning("Got message with truncated control data (too many fds sent?), ignoring.");
-                return 0;
-        }
-        if (n < 0)
+        if (n < 0) {
+                if (ERRNO_IS_TRANSIENT(n))
+                        return 0; /* Spurious wakeup, try again */
+                if (n == -EXFULL) {
+                        log_warning("Got message with truncated control data (too many fds sent?), ignoring.");
+                        return 0;
+                }
                 /* If this is any other, real error, then let's stop processing this socket. This of course
                  * means we won't take notification messages anymore, but that's still better than busy
                  * looping around this: being woken up over and over again but being unable to actually read
                  * the message off the socket. */
                 return log_error_errno(n, "Failed to receive notification message: %m");
+        }
 
         CMSG_FOREACH(cmsg, &msghdr) {
                 if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) {
@@ -2716,19 +2717,18 @@ static int manager_dispatch_signal_fd(sd_event_source *source, int fd, uint32_t
         }
 
         n = read(m->signal_fd, &sfsi, sizeof(sfsi));
-        if (n != sizeof(sfsi)) {
-                if (n >= 0) {
-                        log_warning("Truncated read from signal fd (%zu bytes), ignoring!", n);
-                        return 0;
-                }
-
-                if (IN_SET(errno, EINTR, EAGAIN))
+        if (n < 0) {
+                if (ERRNO_IS_TRANSIENT(errno))
                         return 0;
 
                 /* We return an error here, which will kill this handler,
                  * to avoid a busy loop on read error. */
                 return log_error_errno(errno, "Reading from signal fd failed: %m");
         }
+        if (n != sizeof(sfsi)) {
+                log_warning("Truncated read from signal fd (%zu bytes), ignoring!", n);
+                return 0;
+        }
 
         log_received_signal(sfsi.ssi_signo == SIGCHLD ||
                             (sfsi.ssi_signo == SIGTERM && MANAGER_IS_USER(m))
@@ -4263,7 +4263,7 @@ int manager_dispatch_user_lookup_fd(sd_event_source *source, int fd, uint32_t re
 
         l = recv(fd, &buffer, sizeof(buffer), MSG_DONTWAIT);
         if (l < 0) {
-                if (IN_SET(errno, EINTR, EAGAIN))
+                if (ERRNO_IS_TRANSIENT(errno))
                         return 0;
 
                 return log_error_errno(errno, "Failed to read from user lookup fd: %m");
index 999cecc96c6c76a6a6d12abfe852d4670852d908..29ec66fd4db18718285ed3bdedf33b0d6039676e 100644 (file)
@@ -184,7 +184,7 @@ int path_spec_fd_event(PathSpec *s, uint32_t revents) {
 
         l = read(s->inotify_fd, &buffer, sizeof(buffer));
         if (l < 0) {
-                if (IN_SET(errno, EAGAIN, EINTR))
+                if (ERRNO_IS_TRANSIENT(errno))
                         return 0;
 
                 return log_error_errno(errno, "Failed to read inotify event: %m");
index 65d7d98dbc4bf2233c8441825287befd947d0917..d49fcedb57b5d7beac0faa7047d396bd499ebf08 100644 (file)
@@ -1122,10 +1122,11 @@ static int on_notify_socket(sd_event_source *s, int fd, uint32_t revents, void *
         assert(m);
 
         n = read_datagram(fd, &sender, &datagram, &passed_fd);
-        if (IN_SET(n, -EAGAIN, -EINTR))
-                return 0;
-        if (n < 0)
+        if (n < 0) {
+                if (ERRNO_IS_TRANSIENT(n))
+                        return 0;
                 return log_error_errno(n, "Failed to read notify datagram: %m");
+        }
 
         if (sender.pid <= 0) {
                 log_warning("Received notify datagram without valid sender PID, ignoring.");
index 66771f63e23c953acf8401e1b91496b8c1a9cd30..125b2dc808308ce5caadca017c157ae40fc29f9b 100644 (file)
@@ -567,10 +567,11 @@ static int manager_on_notify(sd_event_source *s, int fd, uint32_t revents, void
         int r;
 
         n = recvmsg_safe(fd, &msghdr, MSG_DONTWAIT|MSG_CMSG_CLOEXEC);
-        if (IN_SET(n, -EAGAIN, -EINTR))
-                return 0;
-        if (n < 0)
+        if (n < 0) {
+                if (ERRNO_IS_TRANSIENT(n))
+                        return 0;
                 return (int) n;
+        }
 
         cmsg_close_all(&msghdr);
 
index a9b745772bb3590f035731f9526a5b9e8d33e8bc..1b79e9366c2c8bfedd7258c020c119b8570b3f04 100644 (file)
@@ -326,7 +326,7 @@ static int server_read_dev_kmsg(Server *s) {
                         return 0;
                 }
 
-                if (IN_SET(errno, EAGAIN, EINTR, EPIPE))
+                if (ERRNO_IS_TRANSIENT(errno) || errno == EPIPE)
                         return 0;
 
                 return log_error_errno(errno, "Failed to read from /dev/kmsg: %m");
index 8e2990190ba2ee29652947e55c32c10ad7965f76..5ba9b3765b9fd41a1a609d46105660ca09ce6f71 100644 (file)
@@ -1317,14 +1317,15 @@ int server_process_datagram(
         iovec = IOVEC_MAKE(s->buffer, MALLOC_ELEMENTSOF(s->buffer) - 1); /* Leave room for trailing NUL we add later */
 
         n = recvmsg_safe(fd, &msghdr, MSG_DONTWAIT|MSG_CMSG_CLOEXEC);
-        if (IN_SET(n, -EINTR, -EAGAIN))
-                return 0;
-        if (n == -EXFULL) {
-                log_warning("Got message with truncated control data (too many fds sent?), ignoring.");
-                return 0;
-        }
-        if (n < 0)
+        if (n < 0) {
+                if (ERRNO_IS_TRANSIENT(n))
+                        return 0;
+                if (n == -EXFULL) {
+                        log_warning("Got message with truncated control data (too many fds sent?), ignoring.");
+                        return 0;
+                }
                 return log_error_errno(n, "recvmsg() failed: %m");
+        }
 
         CMSG_FOREACH(cmsg, &msghdr)
                 if (cmsg->cmsg_level == SOL_SOCKET &&
index 26909840da97944d31957f02869d97da4fda70a8..d94b1df02dc2018f403372dde11f18ca0cdf50e4 100644 (file)
@@ -588,7 +588,7 @@ static int stdout_stream_process(sd_event_source *es, int fd, uint32_t revents,
 
         l = recvmsg(s->fd, &msghdr, MSG_DONTWAIT|MSG_CMSG_CLOEXEC);
         if (l < 0) {
-                if (IN_SET(errno, EINTR, EAGAIN))
+                if (ERRNO_IS_TRANSIENT(errno))
                         return 0;
 
                 log_warning_errno(errno, "Failed to read from stream: %m");
index 45c2351c53e4d0eeb71261a1a3e32f673e89429a..14cbde133f85004b7c3c675773fa08483681b7bc 100644 (file)
@@ -1945,7 +1945,7 @@ static int client_receive_message_udp(
         len = recv(fd, message, buflen, 0);
         if (len < 0) {
                 /* see comment above for why we shouldn't error out on ENETDOWN. */
-                if (IN_SET(errno, EAGAIN, EINTR, ENETDOWN))
+                if (ERRNO_IS_TRANSIENT(errno) || errno == ENETDOWN)
                         return 0;
 
                 return log_dhcp_client_errno(client, errno,
@@ -2035,12 +2035,12 @@ static int client_receive_message_raw(
         iov = IOVEC_MAKE(packet, buflen);
 
         len = recvmsg_safe(fd, &msg, 0);
-        if (IN_SET(len, -EAGAIN, -EINTR, -ENETDOWN))
-                return 0;
-        if (len < 0)
+        if (len < 0) {
+                if (ERRNO_IS_TRANSIENT(len) || len == -ENETDOWN)
+                        return 0;
                 return log_dhcp_client_errno(client, len,
                                              "Could not receive message from raw socket: %m");
-
+        }
         if ((size_t) len < sizeof(DHCPPacket))
                 return 0;
 
index 261818b46ac8905153ca880c8b3fe772767e9e9c..f535e316f907063a7a5e2eeca4cb056a59538bd7 100644 (file)
@@ -1206,10 +1206,12 @@ static int server_receive_message(sd_event_source *s, int fd,
         iov = IOVEC_MAKE(message, datagram_size);
 
         len = recvmsg_safe(fd, &msg, 0);
-        if (IN_SET(len, -EAGAIN, -EINTR))
-                return 0;
-        if (len < 0)
+        if (len < 0) {
+                if (ERRNO_IS_TRANSIENT(len))
+                        return 0;
                 return len;
+        }
+
         if ((size_t) len < sizeof(DHCPMessage))
                 return 0;
 
index 663e2d64b4b1b011665d4e2eb0d8d96e37840804..29c8f78a8f92b6cf98ba5d34696fcdb5dde4be64 100644 (file)
@@ -1479,7 +1479,7 @@ static int client_receive_message(
         len = recvmsg_safe(fd, &msg, MSG_DONTWAIT);
         if (len < 0) {
                 /* see comment above for why we shouldn't error out on ENETDOWN. */
-                if (IN_SET(len, -EAGAIN, -EINTR, -ENETDOWN))
+                if (ERRNO_IS_TRANSIENT(len) || len == -ENETDOWN)
                         return 0;
 
                 return log_dhcp6_client_errno(client, len, "Could not receive message from UDP socket: %m");
index 0a975fbbadf357ee8347ac136419100cd3e33000..9b35d2c48eac5054758a1457dc9443828b03e83f 100644 (file)
@@ -362,7 +362,7 @@ static int ipv4acd_on_packet(
 
         n = recv(fd, &packet, sizeof(struct ether_arp), 0);
         if (n < 0) {
-                if (IN_SET(errno, EAGAIN, EINTR))
+                if (ERRNO_IS_TRANSIENT(errno))
                         return 0;
 
                 log_ipv4acd_errno(acd, errno, "Failed to read ARP packet: %m");
index 761e4b31282a2d4553e909700ad81deabed6fbd8..4caed52a9884e6914c8087bcac52fba62be07cb0 100644 (file)
@@ -212,7 +212,7 @@ static int lldp_rx_receive_datagram(sd_event_source *s, int fd, uint32_t revents
 
         length = recv(fd, LLDP_NEIGHBOR_RAW(n), n->raw_size, MSG_DONTWAIT);
         if (length < 0) {
-                if (IN_SET(errno, EAGAIN, EINTR))
+                if (ERRNO_IS_TRANSIENT(errno))
                         return 0;
 
                 log_lldp_rx_errno(lldp_rx, errno, "Failed to read LLDP datagram, ignoring: %m");
index 3c916f246663bfae6a3010eb134592c76c9c4aac..dd257eadfe800931638ed218b7943ae4777ac582 100644 (file)
@@ -3142,7 +3142,7 @@ static int flush_timer(sd_event *e, int fd, uint32_t events, usec_t *next) {
 
         ss = read(fd, &x, sizeof(x));
         if (ss < 0) {
-                if (IN_SET(errno, EAGAIN, EINTR))
+                if (ERRNO_IS_TRANSIENT(errno))
                         return 0;
 
                 return -errno;
@@ -3348,7 +3348,7 @@ static int process_signal(sd_event *e, struct signal_data *d, uint32_t events, i
 
                 n = read(d->fd, &si, sizeof(si));
                 if (n < 0) {
-                        if (IN_SET(errno, EAGAIN, EINTR))
+                        if (ERRNO_IS_TRANSIENT(errno))
                                 return 0;
 
                         return -errno;
@@ -3402,7 +3402,7 @@ static int event_inotify_data_read(sd_event *e, struct inotify_data *d, uint32_t
 
         n = read(d->fd, &d->buffer, sizeof(d->buffer));
         if (n < 0) {
-                if (IN_SET(errno, EAGAIN, EINTR))
+                if (ERRNO_IS_TRANSIENT(errno))
                         return 0;
 
                 return -errno;
index 738c6974687e03d475daf57e66ed166b662ae78e..4861726673c2ea223a853d042c5c62708f551611 100644 (file)
@@ -2698,7 +2698,7 @@ _public_ int sd_journal_process(sd_journal *j) {
 
                 l = read(j->inotify_fd, &buffer, sizeof(buffer));
                 if (l < 0) {
-                        if (IN_SET(errno, EAGAIN, EINTR))
+                        if (ERRNO_IS_TRANSIENT(errno))
                                 return got_something ? determine_change(j) : SD_JOURNAL_NOP;
 
                         return -errno;
index 888b5bcf35849514ccdf66829d557e9c0171857e..7197cb4daa494576cddee505d6c1691edd01f6bc 100644 (file)
@@ -235,12 +235,13 @@ static int socket_recv_message(int fd, struct iovec *iov, uint32_t *ret_mcast_gr
         assert(iov);
 
         n = recvmsg_safe(fd, &msg, MSG_TRUNC | (peek ? MSG_PEEK : 0));
-        if (n == -ENOBUFS)
-                return log_debug_errno(n, "sd-netlink: kernel receive buffer overrun");
-        if (IN_SET(n, -EAGAIN, -EINTR))
-                return 0;
-        if (n < 0)
+        if (n < 0) {
+                if (n == -ENOBUFS)
+                        return log_debug_errno(n, "sd-netlink: kernel receive buffer overrun");
+                if (ERRNO_IS_TRANSIENT(n))
+                        return 0;
                 return (int) n;
+        }
 
         if (sender.nl.nl_pid != 0) {
                 /* not from the kernel, ignore */
index dc48e918378ea5b88c6aabdc9db49c9c64cda268..1f32a1eb46db319dfb35111e15543a98f537a617 100644 (file)
@@ -462,7 +462,7 @@ _public_ int sd_network_monitor_flush(sd_network_monitor *m) {
 
         l = read(fd, &buffer, sizeof(buffer));
         if (l < 0) {
-                if (IN_SET(errno, EAGAIN, EINTR))
+                if (ERRNO_IS_TRANSIENT(errno))
                         return 0;
 
                 return -errno;
index 47658828367ed579b2fbac57dac897aa53f9ea9e..8f17ab8810c013505853bce6f955872fe375b519 100644 (file)
@@ -4211,14 +4211,15 @@ static int nspawn_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t r
         }
 
         n = recvmsg_safe(fd, &msghdr, MSG_DONTWAIT|MSG_CMSG_CLOEXEC);
-        if (IN_SET(n, -EAGAIN, -EINTR))
-                return 0;
-        if (n == -EXFULL) {
-                log_warning("Got message with truncated control data (too many fds sent?), ignoring.");
-                return 0;
-        }
-        if (n < 0)
+        if (n < 0) {
+                if (ERRNO_IS_TRANSIENT(n))
+                        return 0;
+                if (n == -EXFULL) {
+                        log_warning("Got message with truncated control data (too many fds sent?), ignoring.");
+                        return 0;
+                }
                 return log_warning_errno(n, "Couldn't read notification socket: %m");
+        }
 
         cmsg_close_all(&msghdr);
 
index 719f6219bf01de395c1a7d907c9127328ffa759c..f48e2a8029850bfa69fb5477a8eff70be557260f 100644 (file)
@@ -323,7 +323,7 @@ static int on_stream_io(sd_event_source *es, int fd, uint32_t revents, void *use
 
                 ssize_t ss = dns_stream_writev(s, iov, ELEMENTSOF(iov), 0);
                 if (ss < 0) {
-                        if (!IN_SET(-ss, EINTR, EAGAIN))
+                        if (!ERRNO_IS_TRANSIENT(ss))
                                 return dns_stream_complete(s, -ss);
                 } else {
                         progressed = true;
@@ -347,7 +347,7 @@ static int on_stream_io(sd_event_source *es, int fd, uint32_t revents, void *use
 
                         ss = dns_stream_read(s, (uint8_t*) &s->read_size + s->n_read, sizeof(s->read_size) - s->n_read);
                         if (ss < 0) {
-                                if (!IN_SET(-ss, EINTR, EAGAIN))
+                                if (!ERRNO_IS_TRANSIENT(ss))
                                         return dns_stream_complete(s, -ss);
                         } else if (ss == 0)
                                 return dns_stream_complete(s, ECONNRESET);
@@ -400,7 +400,7 @@ static int on_stream_io(sd_event_source *es, int fd, uint32_t revents, void *use
                                           (uint8_t*) DNS_PACKET_DATA(s->read_packet) + s->n_read - sizeof(s->read_size),
                                           sizeof(s->read_size) + be16toh(s->read_size) - s->n_read);
                                 if (ss < 0) {
-                                        if (!IN_SET(-ss, EINTR, EAGAIN))
+                                        if (!ERRNO_IS_TRANSIENT(ss))
                                                 return dns_stream_complete(s, -ss);
                                 } else if (ss == 0)
                                         return dns_stream_complete(s, ECONNRESET);
index 431093ad01c64cf0470ceebef7fde3cb4139fe04..6b32ee4cf07b6faada3d56ae60bb018e37064752 100644 (file)
@@ -792,10 +792,13 @@ int manager_recv(Manager *m, int fd, DnsProtocol protocol, DnsPacket **ret) {
         iov = IOVEC_MAKE(DNS_PACKET_DATA(p), p->allocated);
 
         l = recvmsg_safe(fd, &mh, 0);
-        if (IN_SET(l, -EAGAIN, -EINTR))
-                return 0;
-        if (l <= 0)
+        if (l < 0) {
+                if (ERRNO_IS_TRANSIENT(l))
+                        return 0;
                 return l;
+        }
+        if (l == 0)
+                return 0;
 
         assert(!(mh.msg_flags & MSG_TRUNC));
 
index b6cdb9959684aaa6fdcdd1a6449713c2ec4f87b6..17474fe0be388e5aa25af52668b900ca70c0343a 100644 (file)
@@ -291,12 +291,13 @@ int ask_password_plymouth(
 
                 k = read(fd, buffer + p, sizeof(buffer) - p);
                 if (k < 0) {
-                        if (IN_SET(errno, EINTR, EAGAIN))
+                        if (ERRNO_IS_TRANSIENT(errno))
                                 continue;
 
                         r = -errno;
                         goto finish;
-                } else if (k == 0) {
+                }
+                if (k == 0) {
                         r = -EIO;
                         goto finish;
                 }
@@ -522,7 +523,7 @@ int ask_password_tty(
 
                 n = read(ttyfd >= 0 ? ttyfd : STDIN_FILENO, &c, 1);
                 if (n < 0) {
-                        if (IN_SET(errno, EINTR, EAGAIN))
+                        if (ERRNO_IS_TRANSIENT(errno))
                                 continue;
 
                         r = -errno;
@@ -882,20 +883,21 @@ int ask_password_agent(
                 };
 
                 n = recvmsg_safe(socket_fd, &msghdr, 0);
-                if (IN_SET(n, -EAGAIN, -EINTR))
-                        continue;
-                if (n == -EXFULL) {
-                        log_debug("Got message with truncated control data, ignoring.");
-                        continue;
-                }
                 if (n < 0) {
+                        if (ERRNO_IS_TRANSIENT(n))
+                                continue;
+                        if (n == -EXFULL) {
+                                log_debug("Got message with truncated control data, ignoring.");
+                                continue;
+                        }
+
                         r = (int) n;
                         goto finish;
                 }
 
                 cmsg_close_all(&msghdr);
 
-                if (n <= 0) {
+                if (n == 0) {
                         log_debug("Message too short");
                         continue;
                 }
index 87061f55d7ed9ffd45ca7f0e6bf52aa8da76649e..cbe54a60cd0af6f239366c1b3f2c2b48d08b2ff5 100644 (file)
@@ -10,6 +10,7 @@
 #include <unistd.h>
 
 #include "barrier.h"
+#include "errno-util.h"
 #include "fd-util.h"
 #include "io-util.h"
 #include "macro.h"
@@ -178,7 +179,7 @@ static bool barrier_write(Barrier *b, uint64_t buf) {
         assert(b->me >= 0);
         do {
                 len = write(b->me, &buf, sizeof(buf));
-        } while (len < 0 && IN_SET(errno, EAGAIN, EINTR));
+        } while (len < 0 && ERRNO_IS_TRANSIENT(errno));
 
         if (len != sizeof(buf))
                 goto error;
@@ -230,7 +231,7 @@ static bool barrier_read(Barrier *b, int64_t comp) {
 
                         /* events on @them signal new data for us */
                         len = read(b->them, &buf, sizeof(buf));
-                        if (len < 0 && IN_SET(errno, EAGAIN, EINTR))
+                        if (len < 0 && ERRNO_IS_TRANSIENT(errno))
                                 continue;
 
                         if (len != sizeof(buf))
index aba483449a92d6a240546156a6b2ce22bb2e0ceb..7e9ab19666e98c82f30e48b672729e6f950d88c0 100644 (file)
@@ -190,7 +190,7 @@ static int connection_shovel(
                         } else if (z == 0 || ERRNO_IS_DISCONNECT(errno)) {
                                 *from_source = sd_event_source_unref(*from_source);
                                 *from = safe_close(*from);
-                        } else if (!IN_SET(errno, EAGAIN, EINTR))
+                        } else if (!ERRNO_IS_TRANSIENT(errno))
                                 return log_error_errno(errno, "Failed to splice: %m");
                 }
 
@@ -202,7 +202,7 @@ static int connection_shovel(
                         } else if (z == 0 || ERRNO_IS_DISCONNECT(errno)) {
                                 *to_source = sd_event_source_unref(*to_source);
                                 *to = safe_close(*to);
-                        } else if (!IN_SET(errno, EAGAIN, EINTR))
+                        } else if (!ERRNO_IS_TRANSIENT(errno))
                                 return log_error_errno(errno, "Failed to splice: %m");
                 }
         } while (shoveled);
index 606b0160a41ce7ee20511b91acaf026d6cc9399e..f42e6496bb3e7fdc9aaecdf2ab94479f6b693006 100644 (file)
@@ -85,7 +85,7 @@ static int inotify_handler(sd_event_source *s,
 
         l = read(fd, &buffer, sizeof(buffer));
         if (l < 0) {
-                if (IN_SET(errno, EAGAIN, EINTR))
+                if (ERRNO_IS_TRANSIENT(errno))
                         return 0;
 
                 return log_warning_errno(errno, "Lost access to inotify: %m");
index d37652db670ff1878c364aa2e8f9fad6d9502e73..8380d674c50d84afad7614a97c5d967ce9f1293f 100644 (file)
@@ -1349,7 +1349,7 @@ static int on_inotify(sd_event_source *s, int fd, uint32_t revents, void *userda
 
         l = read(fd, &buffer, sizeof(buffer));
         if (l < 0) {
-                if (IN_SET(errno, EAGAIN, EINTR))
+                if (ERRNO_IS_TRANSIENT(errno))
                         return 1;
 
                 return log_error_errno(errno, "Failed to read inotify fd: %m");