Permit file objects in python header constructor
[platform/upstream/rpm.git] / build / build.c
index a3454db..a4a271a 100644 (file)
@@ -15,21 +15,18 @@ static int _build_debug = 0;
 
 /**
  */
-static void doRmSource(rpmSpec spec)
+rpmRC doRmSource(rpmSpec spec)
 {
     struct Source *p;
     Package pkg;
-    int rc;
+    int rc = 0;
     
-#if 0
-    rc = unlink(spec->specFile);
-#endif
-
     for (p = spec->sources; p != NULL; p = p->next) {
        if (! (p->flags & RPMBUILD_ISNO)) {
            char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
            rc = unlink(fn);
            fn = _free(fn);
+           if (rc) goto exit;
        }
     }
 
@@ -39,9 +36,12 @@ static void doRmSource(rpmSpec spec)
                char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
                rc = unlink(fn);
                fn = _free(fn);
+               if (rc) goto exit;
            }
        }
     }
+exit:
+    return !rc ? RPMRC_OK : RPMRC_FAIL;
 }
 
 /*
@@ -187,7 +187,7 @@ fprintf(stderr, "*** rootDir %s buildDir %s\n", rootDir, buildDir);
        rpmlog(RPMLOG_ERR, _("Exec of %s failed (%s): %s\n"),
                scriptName, name, strerror(errno));
 
-       _exit(-1);
+       _exit(127); /* exit 127 for compatibility with bash(1) */
     }
 
     pid = waitpid(child, &status, 0);