From a366612ec3fde6b2506072fa2288454118fda29d Mon Sep 17 00:00:00 2001 From: Jindrich Novy Date: Thu, 7 Aug 2008 14:50:49 +0200 Subject: [PATCH] Don't allow multiple definition of PatchX or SourceX (rhbz#458261, rhbz#458260) --- build/spec.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/build/spec.c b/build/spec.c index 096ff73..58e8908 100644 --- a/build/spec.c +++ b/build/spec.c @@ -299,6 +299,16 @@ int addSource(rpmSpec spec, Package pkg, const char *field, rpmTag tag) *fieldp = ch; } + /* Check whether tags of the same number haven't already been defined */ + for (p = spec->sources; p != NULL; p = p->next) { + if ( p->num != num ) continue; + if (tag == RPMTAG_SOURCE && p->flags == RPMBUILD_ISSOURCE || + tag == RPMTAG_PATCH && p->flags == RPMBUILD_ISPATCH) { + rpmlog(RPMLOG_ERR, _("%s %d defined multiple times\n"), name, num); + return RPMRC_FAIL; + } + } + /* Create the entry and link it in */ p = xmalloc(sizeof(*p)); p->num = num; -- 2.7.4