diff options
| author | Richard M. Stallman | 1994-07-26 19:56:03 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-07-26 19:56:03 +0000 |
| commit | cd33a5a086d82618167efebca2d3ea1927a09e57 (patch) | |
| tree | c8eb572864abbc11a1e9c930eb8b5f78e50fe7ab /lib-src/emacsclient.c | |
| parent | 980ab937d9829c91db08bbf830c4c951f13c4370 (diff) | |
| download | emacs-cd33a5a086d82618167efebca2d3ea1927a09e57.tar.gz emacs-cd33a5a086d82618167efebca2d3ea1927a09e57.zip | |
(main): Don't actually modify argv[0]. Modify a copy instead.
Diffstat (limited to 'lib-src/emacsclient.c')
| -rw-r--r-- | lib-src/emacsclient.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index cacfaa8658f..f613daf21d5 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c | |||
| @@ -251,19 +251,20 @@ main (argc, argv) | |||
| 251 | while (argc) | 251 | while (argc) |
| 252 | { | 252 | { |
| 253 | int need_cwd = 0; | 253 | int need_cwd = 0; |
| 254 | if (*argv[0] == '+') | 254 | char *modified_arg = argv[0]; |
| 255 | if (*modified_arg == '+') | ||
| 255 | { | 256 | { |
| 256 | char *p = argv[0] + 1; | 257 | char *p = modified_arg + 1; |
| 257 | while (*p >= '0' && *p <= '9') p++; | 258 | while (*p >= '0' && *p <= '9') p++; |
| 258 | if (*p != 0) | 259 | if (*p != 0) |
| 259 | need_cwd = 1; | 260 | need_cwd = 1; |
| 260 | } | 261 | } |
| 261 | else if (*argv[0] != '/') | 262 | else if (*modified_arg != '/') |
| 262 | need_cwd = 1; | 263 | need_cwd = 1; |
| 263 | 264 | ||
| 264 | if (need_cwd) | 265 | if (need_cwd) |
| 265 | used += strlen (cwd); | 266 | used += strlen (cwd); |
| 266 | used += strlen (argv[0]) + 1; | 267 | used += strlen (modified_arg) + 1; |
| 267 | while (used + 2 > size_allocated) | 268 | while (used + 2 > size_allocated) |
| 268 | { | 269 | { |
| 269 | size_allocated *= 2; | 270 | size_allocated *= 2; |
| @@ -275,7 +276,7 @@ main (argc, argv) | |||
| 275 | if (need_cwd) | 276 | if (need_cwd) |
| 276 | strcat (msgp->mtext, cwd); | 277 | strcat (msgp->mtext, cwd); |
| 277 | 278 | ||
| 278 | strcat (msgp->mtext, argv[0]); | 279 | strcat (msgp->mtext, modified_arg); |
| 279 | strcat (msgp->mtext, " "); | 280 | strcat (msgp->mtext, " "); |
| 280 | argv++; argc--; | 281 | argv++; argc--; |
| 281 | } | 282 | } |