mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-08 22:45:43 +00:00
75 lines
2.1 KiB
Diff
75 lines
2.1 KiB
Diff
|
From 163b8aae99b1b206e5ae85763e21f47b7651f9c4 Mon Sep 17 00:00:00 2001
|
||
|
From: "Erik M. Bray" <erik.bray@lri.fr>
|
||
|
Date: Tue, 4 Dec 2018 12:44:23 +0000
|
||
|
Subject: [PATCH 1/3] a version of the writeandcheck.patch from Sage that works
|
||
|
against 4.10
|
||
|
|
||
|
---
|
||
|
src/sysfiles.c | 18 +++++++++++++-----
|
||
|
1 file changed, 13 insertions(+), 5 deletions(-)
|
||
|
|
||
|
diff --git a/src/sysfiles.c b/src/sysfiles.c
|
||
|
index 2250784..45b4347 100644
|
||
|
--- a/src/sysfiles.c
|
||
|
+++ b/src/sysfiles.c
|
||
|
@@ -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, size_t len)
|
||
|
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;
|
||
|
}
|
||
|
|
||
|
--
|
||
|
1.9.1
|
||
|
|