aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1993-11-05 21:43:08 +0000
committerRichard Stallman <rms@gnu.org>1993-11-05 21:43:08 +0000
commitc9a8a295f8a7bfc5ee71ea636ab9f6d8a7c362c3 (patch)
treee4328c32b4b4bba25d3e32f0e10b0f1923db8efb /gcc
parent6c8747b19a6eaef778e79a05c03e738677e987b5 (diff)
downloadgcc-c9a8a295f8a7bfc5ee71ea636ab9f6d8a7c362c3.zip
gcc-c9a8a295f8a7bfc5ee71ea636ab9f6d8a7c362c3.tar.gz
gcc-c9a8a295f8a7bfc5ee71ea636ab9f6d8a7c362c3.tar.bz2
(safe_read, safe_write): Handle EINTR.
From-SVN: r6015
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cccp.c16
-rw-r--r--gcc/protoize.c18
2 files changed, 29 insertions, 5 deletions
diff --git a/gcc/cccp.c b/gcc/cccp.c
index 3581dc0..434e053 100644
--- a/gcc/cccp.c
+++ b/gcc/cccp.c
@@ -993,7 +993,13 @@ safe_read (desc, ptr, len)
while (left > 0) {
int nchars = read (desc, ptr, left);
if (nchars < 0)
- return nchars;
+ {
+#ifdef EINTR
+ if (errno == EINTR)
+ continue;
+#endif
+ return nchars;
+ }
if (nchars == 0)
break;
ptr += nchars;
@@ -1014,7 +1020,13 @@ safe_write (desc, ptr, len)
while (len > 0) {
int written = write (desc, ptr, len);
if (written < 0)
- pfatal_with_name (out_fname);
+ {
+#ifdef EINTR
+ if (errno == EINTR)
+ continue;
+#endif
+ pfatal_with_name (out_fname);
+ }
ptr += written;
len -= written;
}
diff --git a/gcc/protoize.c b/gcc/protoize.c
index fee6a15..ef793d3 100644
--- a/gcc/protoize.c
+++ b/gcc/protoize.c
@@ -745,7 +745,13 @@ safe_read (desc, ptr, len)
while (left > 0) {
int nchars = read (desc, ptr, left);
if (nchars < 0)
- return nchars;
+ {
+#ifdef EINTR
+ if (errno == EINTR)
+ continue;
+#endif
+ return nchars;
+ }
if (nchars == 0)
break;
ptr += nchars;
@@ -767,8 +773,14 @@ safe_write (desc, ptr, len, out_fname)
while (len > 0) {
int written = write (desc, ptr, len);
if (written < 0)
- fprintf (stderr, "%s: error writing file `%s': %s\n",
- pname, shortpath (NULL, out_fname), sys_errlist[errno]);
+ {
+#ifdef EINTR
+ if (errno == EINTR)
+ continue;
+#endif
+ fprintf (stderr, "%s: error writing file `%s': %s\n",
+ pname, shortpath (NULL, out_fname), sys_errlist[errno]);
+ }
ptr += written;
len -= written;
}