From a38029638432af9cc40feef3c201ef1ba79fe0c2 Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Tue, 5 Mar 2024 13:47:02 +0100 Subject: [PATCH] Use basename (3) for the %basename macro --- rpmio/macro.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/rpmio/macro.c b/rpmio/macro.c index c270eeea51..22e340fc0f 100644 --- a/rpmio/macro.c +++ b/rpmio/macro.c @@ -1301,10 +1301,7 @@ static void doFoo(rpmMacroBuf mb, rpmMacroEntry me, ARGV_t argv, size_t *parsed) if (rstreq("basename", me->name)) { buf = xstrdup(argv[1]); - if ((b = strrchr(buf, '/')) == NULL) - b = buf; - else - b++; + b = basename(buf); } else if (rstreq("dirname", me->name)) { buf = xstrdup(argv[1]); b = dirname(buf);