Path: blob/master/build/pkgs/gap/patches/writeandcheck.patch
8818 views
diff -ru src/src/sysfiles.c b/src/sysfiles.c1--- src/src/sysfiles.c 2012-09-16 03:12:06.000000000 +02002+++ b/src/sysfiles.c 2012-11-15 10:33:36.497514033 +01003@@ -86,12 +86,17 @@45/* utility to check return value of 'write' */6ssize_t writeandcheck(int fd, const char *buf, size_t count) {7- int ret;8- ret = write(fd, buf, count);9- if (ret < 0)10- ErrorQuit("Cannot write to file descriptor %d, see 'LastSystemError();'\n",11+ static int depth = 0; /* Recursion depth */12+ int ret;13+ ret = write(fd, buf, count);14+ if (ret < 0 && depth == 0)15+ {16+ depth++;17+ ErrorQuit("Cannot write to file descriptor %d, see 'LastSystemError();'\n",18fd, 0L);19- return ret;20+ depth--;21+ }22+ return ret;23}2425262728