#include <utmpx.h>
#include "alloc-util.h"
+#include "errno-util.h"
#include "fd-util.h"
#include "hostname-util.h"
#include "io-util.h"
p = message;
left = strlen(message);
- end = now(CLOCK_MONOTONIC) + TIMEOUT_USEC;
+ end = usec_add(now(CLOCK_MONOTONIC), TIMEOUT_USEC);
while (left > 0) {
ssize_t n;
int k;
t = now(CLOCK_MONOTONIC);
-
if (t >= end)
return -ETIME;
k = fd_wait_for_event(fd, POLLOUT, end - t);
- if (k < 0)
+ if (k < 0) {
+ if (ERRNO_IS_TRANSIENT(k))
+ continue;
return k;
+ }
if (k == 0)
return -ETIME;
n = write(fd, p, left);
if (n < 0) {
- if (errno == EAGAIN)
+ if (ERRNO_IS_TRANSIENT(errno))
continue;
return -errno;