rpm/rpm-4.11.90-expand-load-arg.patch
2014-07-01 13:39:03 +03:00

31 lines
874 B
Diff

commit d4ab1d82d7888f41b866751d0ef340a82be7cff2
Author: Panu Matilainen <pmatilai@redhat.com>
Date: Tue Jul 1 12:04:40 2014 +0300
Macro-expand %{load:...} argument to make the thing more useful...
diff --git a/rpmio/macro.c b/rpmio/macro.c
index b00155c..1d9bd1c 100644
--- a/rpmio/macro.c
+++ b/rpmio/macro.c
@@ -1093,16 +1093,15 @@ expandMacro(MacroBuf mb, const char *src, size_t slen)
/* Expand builtin macros */
if (STREQ("load", f, fn)) {
- if (g && gn > 0) {
- char arg[gn + 1];
- strncpy(arg, g, gn);
- arg[gn] = '\0';
+ char *arg = NULL;
+ if (g && gn > 0 && expandThis(mb, g, gn, &arg) == 0) {
/* Print failure iff %{load:...} or %{!?load:...} */
if (loadMacroFile(mb->mc, arg) && chkexist == negate) {
rpmlog(RPMLOG_ERR,
_("failed to load macro file %s"), arg);
}
}
+ free(arg);
s = se;
continue;
}