From a754780cd4bb9f72f090c746912514c967df59b2 Mon Sep 17 00:00:00 2001 From: Robert Ancell Date: Thu, 5 Sep 2013 20:11:23 +1200 Subject: Check return value reading from signal pipe --- src/process.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index 819d879a..073cf866 100644 --- a/src/process.c +++ b/src/process.c @@ -322,8 +322,9 @@ handle_signal (GIOChannel *source, GIOCondition condition, gpointer data) pid_t pid; Process *process; - if (read (signal_pipe[0], &signo, sizeof (int)) < 0 || - read (signal_pipe[0], &pid, sizeof (pid_t)) < 0) + errno = 0; + if (read (signal_pipe[0], &signo, sizeof (int)) != sizeof (int) || + read (signal_pipe[0], &pid, sizeof (pid_t)) != sizeof (pid_t)) { g_warning ("Error reading from signal pipe: %s", strerror (errno)); return TRUE; -- cgit v1.2.1