tree-wide: use ERRNO_IS_TRANSIENT()
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user