summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-04 01:00:45 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-04 01:00:45 +0000
commit8fb5a1aceb8a98fd1598a5c821614cbb0e1fa4e6 (patch)
treef5b95c44153c005f421d86a2e38c0008dbd1860c /win32
parentc28fabfdfe0127c1550ce6bb882f8005e7d7cb9c (diff)
stub.c: use argv[0] unchanged
* win32/stub.c (stub_sysinit): use argv[0] unchanged and just insert full path name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50159 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r--win32/stub.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/win32/stub.c b/win32/stub.c
index 3960024fc2..9c3659cb96 100644
--- a/win32/stub.c
+++ b/win32/stub.c
@@ -21,7 +21,7 @@ stub_sysinit(int *argc, char ***argv)
for (i = 1; i < ac; ++i) {
lenall += strlen(av[i]) + 1;
}
- av = realloc(av, lenall + (lenexe + 1) * 2 + sizeof(char *) * (i + 2));
+ av = realloc(av, lenall + len0 + (lenexe + 1) + sizeof(char *) * (i + 2));
if (!av) {
perror("realloc command line");
exit(-1);
@@ -29,11 +29,10 @@ stub_sysinit(int *argc, char ***argv)
*argv = av;
*argc = ++ac;
p = (char *)(av + i + 2);
- memmove(p + (lenexe + 1) * 2, (char *)(av + ac) + len0, lenall);
- memcpy(p, exename, lenexe);
- p[lenexe] = '\0';
+ memmove(p + len0 + lenexe + 1, (char *)(av + ac) + len0, lenall);
+ memmove(p, (char *)(av + ac), len0);
*av++ = p;
- p += lenexe + 1;
+ p += len0;
memcpy(p, exename, lenexe);
p[lenexe] = '\0';
*av++ = p;