Skip to content

Commit

Permalink
Handle EINTR at write()
Browse files Browse the repository at this point in the history
  • Loading branch information
behdad committed Jul 28, 2014
1 parent cd6b563 commit ec68aa7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions bicon/pty_spawn.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,15 @@ _copy (
return -1;
}
for (buf_p = buf, c = 0; count > 0; buf_p += c, count -= c)
{
c = write (1, buf_p, count);
if (c == -1)
{
if (errno != EINTR)
return -1;
c = 0;
}
}
}
if (FD_ISSET (0, &rfds))
{
Expand All @@ -128,7 +136,15 @@ _copy (
return -1;
}
for (buf_p = buf, c = 0; count > 0; buf_p += c, count -= c)
{
c = write (master_fd, buf_p, count);
if (c == -1)
{
if (errno != EINTR)
return -1;
c = 0;
}
}
}
/* Set timeout, such that if things are steady, we update cwd
* next iteration. */
Expand Down

0 comments on commit ec68aa7

Please sign in to comment.