diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2012-08-08 09:43:42 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2012-08-08 09:43:42 +0300 |
commit | e06177ee657fbb1c32e1f651c8ae4da73e87c65b (patch) | |
tree | cd7fc9dd7ea34ecfae801d3da91443a084d2b878 /build | |
parent | 4e221afaa20015de97c7ebb44769772502eb9999 (diff) | |
download | librpm-tizen-e06177ee657fbb1c32e1f651c8ae4da73e87c65b.tar.gz librpm-tizen-e06177ee657fbb1c32e1f651c8ae4da73e87c65b.tar.bz2 librpm-tizen-e06177ee657fbb1c32e1f651c8ae4da73e87c65b.zip |
Fix bogus "unclosed %if" error when %include is used in conditionals
- All rpm versions log a bogus "unclosed %if" error when %include
is used inside %if-%endif (and rpm >= 4.10 actually aborts the
parse): the check for unclosed if occurs before checking whether
there's more to come.
- Move the error check into readLine() EOF path along with the other
similar check to fix, and to consolidate the error handling to
a single spot.
Diffstat (limited to 'build')
-rw-r--r-- | build/parseSpec.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/build/parseSpec.c b/build/parseSpec.c index d527fbbb0..fcec5c5d4 100644 --- a/build/parseSpec.c +++ b/build/parseSpec.c @@ -259,14 +259,7 @@ retry: /* Make sure we have something in the read buffer */ if (!(ofi->readPtr && *(ofi->readPtr))) { if (!fgets(ofi->readBuf, BUFSIZ, ofi->fp)) { - /* EOF */ - if (spec->readStack->next) { - rpmlog(RPMLOG_ERR, _("line %d: Unclosed %%if\n"), - spec->readStack->lineNum); - return PART_ERROR; - } - - /* remove this file from the stack */ + /* EOF, remove this file from the stack */ ofi = popOFI(spec); /* only on last file do we signal EOF to caller */ @@ -311,7 +304,11 @@ int readLine(rpmSpec spec, int strip) if (!restoreFirstChar(spec)) { retry: if ((rc = readLineFromOFI(spec, ofi)) != 0) { - if (startLine > 0) { + if (spec->readStack->next) { + rpmlog(RPMLOG_ERR, _("line %d: Unclosed %%if\n"), + spec->readStack->lineNum); + rc = PART_ERROR; + } else if (startLine > 0) { rpmlog(RPMLOG_ERR, _("line %d: unclosed macro or bad line continuation\n"), startLine); |