commit 4a2b8fe4162e2efad7724fba0f5c353abf4c54b5
parent 188db633ef96ee325dc85be6432d65206f6ae639
Author: cowmonk <cowmonk@based.pt>
Date: Tue, 6 Oct 2026 12:13:18 -0700
util.c: replace _GNU_SOURCE with _POSIX_C_SOURCE and retry interrupted writes
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/util.c b/util.c
@@ -1,7 +1,7 @@
/* Repackaged small subset of libutil/%.c to one util.c */
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE /* needed for strdup */
+#ifndef _POSIX_C_SOURCE
+#define _POSIX_C_SOURCE 200809L
#endif
#include "util.h"
@@ -288,6 +288,8 @@ writeall(int fd, const void *buf, size_t len)
while (len) {
n = write(fd, p, len);
+ if (n < 0 && errno == EINTR)
+ continue;
if (n <= 0)
return n;
p += n;
@@ -321,4 +323,3 @@ fshut(FILE *fp, const char *fname)
return ret;
}
-