summaryrefslogtreecommitdiff
path: root/ruby-runner.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-15 19:25:46 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-15 19:25:46 (GMT)
commit4075d71c18fe46e16eda337d7c02e6aa741b76e9 (patch)
tree3ffa4dc4405762c0f4e99b1f163b3c30f8cf7563 /ruby-runner.c
parent84181a6c88bd9c7d266e2961d808ce12a37e05a4 (diff)
ruby-runner.c: reduce duplicate code
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby-runner.c')
-rw-r--r--ruby-runner.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/ruby-runner.c b/ruby-runner.c
index f44a02b..d0da883 100644
--- a/ruby-runner.c
+++ b/ruby-runner.c
@@ -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;