diff options
author | Mantas MikulÄ—nas <grawity@gmail.com> | 2013-04-14 14:54:09 +0300 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-04-17 00:32:02 -0400 |
commit | ced2d10a28cff3bab6fb613652db5abde8ed940e (patch) | |
tree | 94864b58abc5b914b62b47cd6f9512d078f85ce7 /src | |
parent | a1c65062148a11db39b2ed25bc16ccde0a36e391 (diff) |
fileio: also escape $ and ` when writing out env vars
These are also considered special by sh and bash.
Diffstat (limited to 'src')
-rw-r--r-- | src/shared/fileio.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/shared/fileio.c b/src/shared/fileio.c index 400a416162..617afeace2 100644 --- a/src/shared/fileio.c +++ b/src/shared/fileio.c @@ -529,11 +529,11 @@ static void write_env_var(FILE *f, const char *v) { p++; fwrite(v, 1, p-v, f); - if (string_has_cc(p) || chars_intersect(p, WHITESPACE "\'\"\\")) { + if (string_has_cc(p) || chars_intersect(p, WHITESPACE "\'\"\\`$")) { fputc('\"', f); for (; *p; p++) { - if (strchr("\'\"\\", *p)) + if (strchr("\'\"\\`$", *p)) fputc('\\', f); fputc(*p, f); |