1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

ruby-runner.c: reduce duplicate code

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2017-09-15 19:25:46 +00:00
parent 84181a6c88
commit 4075d71c18

View file

@ -40,11 +40,9 @@ main(int argc, char **argv)
if (strlen(p) < namesize - 1) {
argv[0] = malloc(p - arg0 + namesize);
memcpy(argv[0], arg0, p - arg0);
memcpy(argv[0] + (p - arg0), rubypath + dirsize, namesize);
}
else {
memcpy(p, rubyname, namesize);
p = argv[0] + (p - arg0);
}
memcpy(p, rubyname, namesize);
execv(rubypath, argv);
return -1;