From: root Date: Wed, 21 Feb 1996 15:29:20 +0000 (+0000) Subject: fix extra %endif catching X-Git-Tag: rpm-4.4-release~5359 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6e76ca36c748d7a4438069ee9ee2a8ac07f8156b;p=platform%2Fupstream%2Frpm.git fix extra %endif catching better errors CVS patchset: 376 CVS date: 1996/02/21 15:29:20 --- diff --git a/build/spec.c b/build/spec.c index 8f59250..7b45b99 100644 --- a/build/spec.c +++ b/build/spec.c @@ -366,6 +366,7 @@ static int read_line(FILE *f, char *line) if (! fgets(line, LINE_BUF_SIZE, f)) { /* the end */ if (read_level->next) { + error(RPMERR_UNMATCHEDIF, "Unclosed %%if"); return RPMERR_UNMATCHEDIF; } else { return 0; @@ -386,12 +387,14 @@ static int read_line(FILE *f, char *line) } else if (! strncmp("%else", line, 5)) { if (! read_level->next) { /* Got an else with no %if ! */ + error(RPMERR_UNMATCHEDIF, "Got a %%else with no if"); return RPMERR_UNMATCHEDIF; } read_level->reading = read_level->next->reading && ! read_level->reading; } else if (! strncmp("%endif", line, 6)) { - if (! read_level) { + if (! read_level->next) { + error(RPMERR_UNMATCHEDIF, "Got a %%endif with no if"); return RPMERR_UNMATCHEDIF; } rl = read_level; @@ -787,7 +790,6 @@ Spec parseSpec(FILE *f, char *specfile) } /* switch */ } if (x < 0) { - error(RPMERR_READERROR, "Error reading specfile"); return NULL; }