X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fbash.git;a=blobdiff_plain;f=lib%2Fsh%2Fshquote.c;h=31cce1c179c504d48d87fa3de7adda46529aa308;hp=c79ba9cdfadceafa091b3cc490b1567356ff84d5;hb=1442f67c408e60769ff344f9e4c05104e2cef7d0;hpb=25eee30b53c60c43b155880820d29c84928847ca diff --git a/lib/sh/shquote.c b/lib/sh/shquote.c index c79ba9cdf..31cce1c17 100644 --- a/lib/sh/shquote.c +++ b/lib/sh/shquote.c @@ -94,6 +94,15 @@ sh_single_quote (string) result = (char *)xmalloc (3 + (4 * strlen (string))); r = result; + + if (string[0] == '\'' && string[1] == 0) + { + *r++ = '\\'; + *r++ = '\''; + *r++ = 0; + return result; + } + *r++ = '\''; for (s = string; s && (c = *s); s++)