aboutsummaryrefslogtreecommitdiff
path: root/runcap.c
diff options
context:
space:
mode:
Diffstat (limited to 'runcap.c')
-rw-r--r--runcap.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/runcap.c b/runcap.c
index 26654f8..6790dc4 100644
--- a/runcap.c
+++ b/runcap.c
@@ -134,14 +134,17 @@ stream_capture_get(struct stream_capture *cap, int *feof)
if (cap->sc_level == cap->sc_size) {
if (stream_capture_flush(cap))
return -1;
}
rc = read(cap->sc_fd, cap->sc_base + cap->sc_level, cap->sc_size - cap->sc_level);
- if (rc == -1)
+ if (rc == -1) {
+ if (errno == EINTR)
+ return 0;
return -1;
+ }
if (rc == 0) {
*feof = 1;
return 0;
} else
*feof = 0;
@@ -167,14 +170,17 @@ stream_capture_get(struct stream_capture *cap, int *feof)
static int
stream_capture_put(struct stream_capture *cap, int *feof)
{
if (cap->sc_cur < cap->sc_level) {
int n = write(cap->sc_fd, &cap->sc_base[cap->sc_cur], 1);
- if (n == -1)
+ if (n == -1) {
+ if (errno == EINTR)
+ return 0;
return -1;
+ }
if (n == 0) {
errno = ENOSPC;
return -1;
}
cap->sc_cur++;
}
@@ -326,12 +332,14 @@ runcap_loop(struct runcap *rc)
pid_t pid;
if (nfd == 0 && rc->rc_timeout == 0)
flags = 0;
pid = waitpid(rc->rc_pid, &rc->rc_status, flags);
if (pid == -1) {
+ if (errno == EINTR)
+ continue;
rc->rc_errno = errno;
kill(rc->rc_pid, SIGKILL);
break;
}
if (pid == rc->rc_pid)
rc->rc_pid = (pid_t) -1;

Return to:

Send suggestions and report system problems to the System administrator.