From 6e76ca36c748d7a4438069ee9ee2a8ac07f8156b Mon Sep 17 00:00:00 2001 From: root Date: Wed, 21 Feb 1996 15:29:20 +0000 Subject: [PATCH] fix extra %endif catching better errors CVS patchset: 376 CVS date: 1996/02/21 15:29:20 --- build/spec.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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; } -- 2.7.4