Avoid relying on writable string literals in macros

This hack here is illegal in c++. Just strdup() the silly little string,
it's not like this is a performance critical spot.
This commit is contained in:
Panu Matilainen 2024-03-01 09:37:24 +02:00
parent 401d845d99
commit 3a2b04c96d
1 changed files with 2 additions and 1 deletions

View File

@ -1353,7 +1353,8 @@ static void doFoo(rpmMacroBuf mb, rpmMacroEntry me, ARGV_t argv, size_t *parsed)
} else if (rstreq("getconfdir", me->name)) {
b = (char *)rpmConfigDir();
} else if (rstreq("exists", me->name)) {
b = (access(argv[1], F_OK) == 0) ? "1" : "0";
buf = xstrdup((access(argv[1], F_OK) == 0) ? "1" : "0");
b = buf;
}
if (b) {