Skip to content

Commit

Permalink
Don't let macro '%-x' add extra space between flag and argument
Browse files Browse the repository at this point in the history
  • Loading branch information
rhabacker committed Mar 24, 2023
1 parent bbb48fa commit 8e8301e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions rpmio/macro.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ grabArgs(MacroBuf mb, const rpmMacroEntry me, const char * se,
{
const char *cont = NULL;
const char *opts;
char *args = NULL;
char *args = NULL, *fill = " ";
ARGV_t argv = NULL;
int argc = 0;
int c;
Expand Down Expand Up @@ -764,9 +764,12 @@ grabArgs(MacroBuf mb, const rpmMacroEntry me, const char * se,
goto exit;
}

if (optind > 1 && argv[optind-1] && argv[optind-1][0] == '-') {
fill = "";
}
rasprintf(&name, "-%c", c);
if (optarg) {
rasprintf(&body, "-%c %s", c, optarg);
rasprintf(&body, "-%c%s%s", c, fill, optarg);
} else {
rasprintf(&body, "-%c", c);
}
Expand Down

0 comments on commit 8e8301e

Please sign in to comment.