summaryrefslogtreecommitdiffstats
path: root/daemon
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2009-06-20 16:05:12 +0100
committerRichard W.M. Jones <rjones@redhat.com>2009-06-20 16:05:12 +0100
commit6654f617a6f720baa8f1ced89179e11679353d1e (patch)
tree4fe554d9930a2c0cdfb8031d6e8950b6739a1ee7 /daemon
parent3ab8336db394683dad5f485388461e9146ac04ad (diff)
downloadlibguestfs-6654f617a6f720baa8f1ced89179e11679353d1e.tar.gz
libguestfs-6654f617a6f720baa8f1ced89179e11679353d1e.tar.xz
libguestfs-6654f617a6f720baa8f1ced89179e11679353d1e.zip
Check return value from waitpid call in command*() functions.
Diffstat (limited to 'daemon')
-rw-r--r--daemon/guestfsd.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c
index 2e83b9fa..030aabea 100644
--- a/daemon/guestfsd.c
+++ b/daemon/guestfsd.c
@@ -453,7 +453,8 @@ commandrv (char **stdoutput, char **stderror, char * const* const argv)
{
int so_size = 0, se_size = 0;
int so_fd[2], se_fd[2];
- int pid, r, quit, i;
+ pid_t pid;
+ int r, quit, i;
fd_set rset, rset2;
char buf[256];
char *p;
@@ -589,7 +590,10 @@ commandrv (char **stdoutput, char **stderror, char * const* const argv)
}
/* Get the exit status of the command. */
- waitpid (pid, &r, 0);
+ if (waitpid (pid, &r, 0) != pid) {
+ perror ("waitpid");
+ return -1;
+ }
if (WIFEXITED (r)) {
return WEXITSTATUS (r);