From 02dea59e3a2171442973e844b07412158c86bc1e Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Thu, 19 Jan 2017 14:15:38 +0200 Subject: [PATCH] Flag real errors from macro define and undefine errors This WILL cause behavior changes in cases where there have been illegal macro names etc which have previously been more or less ignored with an logged error, but now they will actually abort. --- rpmio/macro.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rpmio/macro.c b/rpmio/macro.c index 4cfea2a80..c9516f9c9 100644 --- a/rpmio/macro.c +++ b/rpmio/macro.c @@ -478,6 +478,7 @@ doDefine(MacroBuf mb, const char * se, size_t slen, int level, int expandbody) int c; int oc = ')'; const char *sbody; /* as-is body start */ + int rc = 1; /* assume failure */ /* Copy name */ COPYNAME(ne, s, c); @@ -582,8 +583,11 @@ doDefine(MacroBuf mb, const char * se, size_t slen, int level, int expandbody) } pushMacro(mb->mc, n, o, b, (level - 1), ME_NONE); + rc = 0; exit: + if (rc) + mb->error = 1; _free(buf); _free(ebody); return se; @@ -613,8 +617,8 @@ doUndefine(MacroBuf mb, const char * se, size_t slen) /* Names must start with alphabetic or _ and be at least 3 chars */ if (!((c = *n) && (risalpha(c) || c == '_') && (ne - n) > 2)) { - rpmlog(RPMLOG_ERR, - _("Macro %%%s has illegal name (%%undefine)\n"), n); + rpmlog(RPMLOG_ERR, _("Macro %%%s has illegal name (%%undefine)\n"), n); + mb->error = 1; goto exit; }