aboutsummaryrefslogtreecommitdiff
path: root/src/progman.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/progman.c')
-rw-r--r--src/progman.c34
1 files changed, 25 insertions, 9 deletions
diff --git a/src/progman.c b/src/progman.c
index c376615..02034ef 100644
--- a/src/progman.c
+++ b/src/progman.c
@@ -205,7 +205,7 @@ find_prog_ref (struct component *comp)
{
comp = comp->prev;
if (!comp)
- return NULL; /* FIXME: Skip redirectors? */
+ return NULL;
}
if (comp->prog)
@@ -312,12 +312,6 @@ progman_waiting_p (void)
return 0;
}
-RETSIGTYPE
-redir_exit (int sig)
-{
- _exit (0);
-}
-
int
redirect_to_file (struct prog *master, int stream)
{
@@ -370,11 +364,33 @@ redirect_read (int fd, void *data)
char const *tag = prog_tag (rb->master);
pid_t pid = rb->master->pid;
char *p;
+ static char *retr_stream_name[] = {
+ [RETR_OUT] = "stdout",
+ [RETR_ERR] = "stderr"
+ };
n = read (fd, rb->text + rb->len, sizeof (rb->text) - rb->len);
if (n == -1)
- return -1;
- if (n > 0)
+ {
+ if (errno != EINTR)
+ {
+ logmsg (LOG_INFO, _("%s: %s while reading %s"),
+ tag, strerror (errno), retr_stream_name[rb->stream]);
+ rb->master->v.p.redir[rb->stream] = -1;
+ close (fd);
+ deregister_socket (fd);
+ return -1;
+ }
+ }
+ else if (n == 0)
+ {
+ logmsg (LOG_INFO, _("%s: EOF on %s"),
+ tag, retr_stream_name[rb->stream]);
+ rb->master->v.p.redir[rb->stream] = -1;
+ close (fd);
+ deregister_socket (fd);
+ }
+ else
{
rb->len += n;

Return to:

Send suggestions and report system problems to the System administrator.