changed error handling in build()
authorroot <devnull@localhost>
Fri, 16 Feb 1996 17:26:05 +0000 (17:26 +0000)
committerroot <devnull@localhost>
Fri, 16 Feb 1996 17:26:05 +0000 (17:26 +0000)
CVS patchset: 298
CVS date: 1996/02/16 17:26:05

rpm.c

diff --git a/rpm.c b/rpm.c
index dfc5b0d..9ce5cb6 100755 (executable)
--- a/rpm.c
+++ b/rpm.c
@@ -148,10 +148,13 @@ void build(char * arg, int buildAmount) {
     }
 
     f = fopen(specfile, "r");
-    if ((s = parseSpec(f, specfile))) {
+    s = parseSpec(f, specfile);
+    fclose(f);
+    if (s) {
        if (doBuild(s, buildAmount)) {
            fprintf(stderr, "Build failed.\n");
        }
+        freeSpec(s);
     } else {
        /* Spec parse failed -- could be Exclude: Exclusive: */
        if (errCode() == RPMERR_BADARCH) {
@@ -160,8 +163,6 @@ void build(char * arg, int buildAmount) {
            fprintf(stderr, "Build failed.\n");
        }
     }
-    freeSpec(s);
-    fclose(f);
 }
 
 int main(int argc, char ** argv) {