# HG changeset patch # User Richard M. Stallman # Date 775252563 0 # Node ID 3f82ba603fa32f038312ba2d70ec0fd9228465f5 # Parent cdd772d2e59fa05188b495a915080eb0cb926fc4 (main): Don't actually modify argv[0]. Modify a copy instead. diff -r cdd772d2e59f -r 3f82ba603fa3 lib-src/emacsclient.c --- a/lib-src/emacsclient.c Tue Jul 26 19:53:49 1994 +0000 +++ b/lib-src/emacsclient.c Tue Jul 26 19:56:03 1994 +0000 @@ -251,19 +251,20 @@ 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 @@ if (need_cwd) strcat (msgp->mtext, cwd); - strcat (msgp->mtext, argv[0]); + strcat (msgp->mtext, modified_arg); strcat (msgp->mtext, " "); argv++; argc--; }