Commit c9a8a295 by Richard Stallman

(safe_read, safe_write): Handle EINTR.

From-SVN: r6015
parent 6c8747b1
......@@ -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;
}
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment