argvsplit: fix some quoting rules to match POSIX
ci/woodpecker/push/woodpecker Pipeline was successful Details

pull/249/head
Ariadne Conill 2023-01-21 19:51:24 +00:00
parent 6a5b55740d
commit be0d811942
1 changed files with 3 additions and 3 deletions

View File

@ -80,7 +80,7 @@ pkgconf_argv_split(const char *src, int *argc, char ***argv)
if (escaped)
{
/* POSIX: only \CHAR is special inside a double quote if CHAR is {$, `, ", \, newline}. */
if (quote)
if (quote == '"')
{
if (!(*src_iter == '$' || *src_iter == '`' || *src_iter == '"' || *src_iter == '\\'))
*dst_iter++ = '\\';
@ -91,7 +91,7 @@ pkgconf_argv_split(const char *src, int *argc, char ***argv)
{
/* If we are outside a quoted string/char, an escaped space is usually used to
preserve spaces in file names. */
if (*src_iter != ' ')
if (!(*src_iter == '$' || *src_iter == '`' || *src_iter == '"' || *src_iter == '\\' || *src_iter == ' '))
*dst_iter++ = '\\';
*dst_iter++ = *src_iter;