Am 04.06.21 um 03:36 schrieb Junio C Hamano:
quoted hunk ↗ jump to hunk
---
write-or-die.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git i/write-or-die.c w/write-or-die.c
index eab8c8d0b9..534b2f5cba 100644
--- i/write-or-die.c
+++ w/write-or-die.c
@@ -57,7 +57,11 @@ void fprintf_or_die(FILE *f, const char *fmt, ...)
void fsync_or_die(int fd, const char *msg)
{
- if (fsync(fd) < 0) {
+ int status;
+
+ while ((status = fsync(fd)) < 0 && errno == EINTR)
+ ; /* try again */
+ if (status < 0) {
die_errno("fsync error on '%s'", msg);
}
}
The function body can be written like this:
while (fsync(fd) < 0) {
if (errno != EINTR)
die_errno("fsync error on '%s'", msg);
}
I find it easier to read because it has less syntax elements
and is shorter. Bikeshedding, of course. :-/
René