Add missing exit status check for waitpid() while executing scriptlets
authorJindrich Novy <jnovy@redhat.com>
Fri, 4 Mar 2011 03:43:32 +0000 (04:43 +0100)
committerJindrich Novy <jnovy@redhat.com>
Fri, 4 Mar 2011 03:43:32 +0000 (04:43 +0100)
build/build.c

index 5924ec6..a5cdc99 100644 (file)
@@ -182,6 +182,13 @@ rpmRC doScript(rpmSpec spec, rpmBuildFlags what, const char *name,
 
     pid = waitpid(child, &status, 0);
 
+    if (pid == -1) {
+       rpmlog(RPMLOG_ERR, _("Error executing scriptlet %s (%s)\n"),
+                scriptName, name);
+       rc = RPMRC_FAIL;
+       goto exit;
+    }
+
     if (!WIFEXITED(status) || WEXITSTATUS(status)) {
        rpmlog(RPMLOG_ERR, _("Bad exit status from %s (%s)\n"),
                 scriptName, name);