From: Richard W.M. Jones Date: Tue, 23 Aug 2011 17:56:12 +0000 (+0100) Subject: pclose: Fix other places where we only tested pclose == -1. X-Git-Tag: 1.10.9~15 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=68fcbb6f5f50d631af90b05da7e5e2efa5de0b46;p=libguestfs.git pclose: Fix other places where we only tested pclose == -1. pclose can return > 0 when the status of the command was non-zero. (cherry picked from commit 631faad97171d7c1238b2e413c663cf61476f440) --- diff --git a/fish/fish.c b/fish/fish.c index 923c6dd..4f1dfc9 100644 --- a/fish/fish.c +++ b/fish/fish.c @@ -878,7 +878,7 @@ execute_and_inline (const char *cmd, int global_exit_on_error) free (line); - if (pclose (pp) == -1) { + if (pclose (pp) != 0) { perror ("pclose"); return -1; } diff --git a/generator/generator_capitests.ml b/generator/generator_capitests.ml index 963ed51..2cad2ae 100644 --- a/generator/generator_capitests.ml +++ b/generator/generator_capitests.ml @@ -106,7 +106,7 @@ md5sum (const char *filename, char *result) perror (\"md5sum: fread\"); exit (EXIT_FAILURE); } - if (pclose (pp) == -1) { + if (pclose (pp) != 0) { perror (\"pclose\"); exit (EXIT_FAILURE); } diff --git a/src/appliance.c b/src/appliance.c index 5683882..6629abb 100644 --- a/src/appliance.c +++ b/src/appliance.c @@ -240,7 +240,7 @@ calculate_supermin_checksum (guestfs_h *g, const char *supermin_path) return NULL; } - if (pclose (pp) == -1) { + if (pclose (pp) != 0) { warning (g, "pclose: %m"); return NULL; } diff --git a/src/dbdump.c b/src/dbdump.c index f9d06aa..2701923 100644 --- a/src/dbdump.c +++ b/src/dbdump.c @@ -131,7 +131,7 @@ guestfs___read_db_dump (guestfs_h *g, } /* Catch errors from the db_dump command. */ - if (pclose (pp) == -1) { + if (pclose (pp) != 0) { perrorf (g, "pclose: %s", cmd); goto out; }