--- src/sysfiles.c.orig 2018-11-01 16:56:12.000000000 -0600
+++ src/sysfiles.c 2019-02-07 13:07:58.554757018 -0700
@@ -159,21 +159,23 @@ SYS_SY_BUFFER syBuffers[32];
/* utility to check return value of 'write' */
ssize_t echoandcheck(int fid, const char *buf, size_t count) {
int ret;
+ static int depth = 0;
+ depth++;
if (syBuf[fid].type == gzip_socket) {
ret = gzwrite(syBuf[fid].gzfp, buf, count);
- if (ret < 0)
+ if (ret < 0 && depth == 1)
ErrorQuit(
"Could not write to compressed file, see 'LastSystemError();'\n",
0L, 0L);
}
else {
ret = write(syBuf[fid].echo, buf, count);
- if (ret < 0)
+ if (ret < 0 && depth == 1)
ErrorQuit("Could not write to file descriptor %d, see "
"'LastSystemError();'\n",
syBuf[fid].fp, 0L);
}
-
+ depth--;
return ret;
}
@@ -1636,21 +1638,27 @@ Int SyWrite(Int fid, const void * ptr, s
static ssize_t SyWriteandcheck(Int fid, const void * buf, size_t count)
{
int ret;
+ static int depth = 0;
+ depth++;
if (syBuf[fid].type == gzip_socket) {
ret = gzwrite(syBuf[fid].gzfp, buf, count);
- if (ret < 0)
+ if (ret < 0 && depth == 1) {
ErrorQuit(
"Cannot write to compressed file, see 'LastSystemError();'\n",
0L, 0L);
+ }
}
else {
ret = write(syBuf[fid].fp, buf, count);
- if (ret < 0)
+ if (ret < 0 && depth == 1) {
ErrorQuit("Cannot write to file descriptor %d, see "
"'LastSystemError();'\n",
syBuf[fid].fp, 0L);
+ }
}
+ depth--;
+
return ret;
}