cli: trim trailing whitespace from package arguments
ci/woodpecker/push/woodpecker Pipeline was successful Details

Signed-off-by: Colin Gillespie <colin@cgillespie.xyz>
master
Colin Gillespie 2023-09-05 15:36:23 +10:00 committed by Ariadne Conill
parent 97d907ba93
commit dd6a8e3fc7
1 changed files with 6 additions and 1 deletions

View File

@ -1341,7 +1341,8 @@ cleanup3:
while (1) while (1)
{ {
const char *package = argv[pkg_optind]; char *package = argv[pkg_optind];
char *end;
if (package == NULL) if (package == NULL)
break; break;
@ -1361,6 +1362,10 @@ cleanup3:
continue; continue;
} }
end = package + strlen(package) - 1;
while(end > package && isspace((unsigned char)end[0])) end--;
end[1] = '\0';
if (argv[pkg_optind + 1] == NULL || !PKGCONF_IS_OPERATOR_CHAR(*(argv[pkg_optind + 1]))) if (argv[pkg_optind + 1] == NULL || !PKGCONF_IS_OPERATOR_CHAR(*(argv[pkg_optind + 1])))
{ {
pkgconf_queue_push(&pkgq, package); pkgconf_queue_push(&pkgq, package);