summaryrefslogtreecommitdiff
path: root/lib-src/emacsclient.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-07-26 19:56:03 +0000
committerRichard M. Stallman <rms@gnu.org>1994-07-26 19:56:03 +0000
commitcd33a5a086d82618167efebca2d3ea1927a09e57 (patch)
treec8eb572864abbc11a1e9c930eb8b5f78e50fe7ab /lib-src/emacsclient.c
parent980ab937d9829c91db08bbf830c4c951f13c4370 (diff)
downloademacs-cd33a5a086d82618167efebca2d3ea1927a09e57.tar.gz
(main): Don't actually modify argv[0]. Modify a copy instead.
Diffstat (limited to 'lib-src/emacsclient.c')
-rw-r--r--lib-src/emacsclient.c11
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)
while (argc)
{
int need_cwd = 0;
- if (*argv[0] == '+')
+ char *modified_arg = argv[0];
+ if (*modified_arg == '+')
{
- char *p = argv[0] + 1;
+ char *p = modified_arg + 1;
while (*p >= '0' && *p <= '9') p++;
if (*p != 0)
need_cwd = 1;
}
- else if (*argv[0] != '/')
+ else if (*modified_arg != '/')
need_cwd = 1;
if (need_cwd)
used += strlen (cwd);
- used += strlen (argv[0]) + 1;
+ used += strlen (modified_arg) + 1;
while (used + 2 > size_allocated)
{
size_allocated *= 2;
@@ -275,7 +276,7 @@ main (argc, argv)
if (need_cwd)
strcat (msgp->mtext, cwd);
- strcat (msgp->mtext, argv[0]);
+ strcat (msgp->mtext, modified_arg);
strcat (msgp->mtext, " ");
argv++; argc--;
}