diff options
author | Nicholas Clark <nick@ccl4.org> | 2006-03-09 21:49:20 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2006-03-09 21:49:20 +0000 |
commit | 5ef5d7584e52b8ae47b9fe227608cf8da8828e4d (patch) | |
tree | 3f146bf3e25b0f0fc114b3959a5f5d17b7722b18 /perl.c | |
parent | 89122651e52a79401bfe24208c007cc022c04e0e (diff) | |
download | perl-5ef5d7584e52b8ae47b9fe227608cf8da8828e4d.tar.gz |
Avoid scribbling on the passed in command line string for -i in
moreswitches.
p4raw-id: //depot/perl@27451
Diffstat (limited to 'perl.c')
-rw-r--r-- | perl.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -3104,13 +3104,17 @@ Perl_moreswitches(pTHX_ char *s) return s+1; } #endif /* __CYGWIN__ */ - PL_inplace = savepv(s+1); - for (s = PL_inplace; *s && !isSPACE(*s); s++) - ; + { + const char *start = ++s; + while (*s && !isSPACE(*s)) + ++s; + + PL_inplace = savepvn(start, s - start); + } if (*s) { - *s++ = '\0'; + ++s; if (*s == '-') /* Additional switches on #! line. */ - s++; + s++; } return s; case 'I': /* -I handled both here and in parse_body() */ |