mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
c28fabfdfe
commit
8fb5a1aceb
1 changed files with 4 additions and 5 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue