diff options
author | tjr <tjr@FreeBSD.org> | 2002-06-06 03:29:23 +0000 |
---|---|---|
committer | tjr <tjr@FreeBSD.org> | 2002-06-06 03:29:23 +0000 |
commit | d658a1e5c790166834e3f1c86f9cc2661ee27173 (patch) | |
tree | a368c71c2d016a29cceea557c8d89df85150acc4 /bin | |
parent | 616a2ae30e25440bc55adf3875d0219669c851d6 (diff) | |
download | FreeBSD-src-d658a1e5c790166834e3f1c86f9cc2661ee27173.zip FreeBSD-src-d658a1e5c790166834e3f1c86f9cc2661ee27173.tar.gz |
Don't modify output that is to be quoted if it contains no IFS characters
or shell metacharacters.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/sh/output.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/bin/sh/output.c b/bin/sh/output.c index 9b8fa5c..ab56b42 100644 --- a/bin/sh/output.c +++ b/bin/sh/output.c @@ -68,6 +68,7 @@ static const char rcsid[] = #include "output.h" #include "memalloc.h" #include "error.h" +#include "var.h" #define OUTBUFSIZ BUFSIZ @@ -140,6 +141,12 @@ outqstr(const char *p, struct output *file) { char ch; + if (p[strcspn(p, "|&;<>()$`\\\"'")] == '\0' && (!ifsset() || + p[strcspn(p, ifsval())] == '\0')) { + outstr(p, file); + return; + } + out1c('\''); while ((ch = *p++) != '\0') { switch (ch) { |