diff options
author | eban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-07-24 09:58:10 +0000 |
---|---|---|
committer | eban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-07-24 09:58:10 +0000 |
commit | b9373b7aeaf51441cd36334635022bd4f9523a4b (patch) | |
tree | d0155ef14afb8fb0e930b3ccbe795222586ae989 /ruby.c | |
parent | a4fe713cb199934e8b7870850c50fcc24fb5685f (diff) |
eban
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r-- | ruby.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -119,12 +119,12 @@ rubylib_mangle(s, l) static char *newp, *oldp; static int newl, oldl, notfound; static char ret[STATIC_FILE_LENGTH+1]; - + if (!newp && !notfound) { newp = getenv("RUBYLIB_PREFIX"); if (newp) { char *s; - + oldp = newp; while (*newp && !ISSPACE(*newp) && *newp != ';') { newp++; oldl++; /* Skip digits. */ @@ -146,19 +146,19 @@ rubylib_mangle(s, l) notfound = 1; } } - if (!newp) { - return s; - } if (l == 0) { l = strlen(s); } - if (l < oldl || strncasecmp(oldp, s, oldl) != 0) { - return s; + if (!newp || l < oldl || strncasecmp(oldp, s, oldl) != 0) { + strncpy(ret, s, l); + ret[l] = 0; + return ret; } if (l + newl - oldl > STATIC_FILE_LENGTH || newl > STATIC_FILE_LENGTH) { rb_fatal("malformed RUBYLIB_PREFIX"); } strcpy(ret + newl, s + oldl); + ret[l + newl - oldl] = 0; return ret; } #define rubylib_mangled_path(s, l) rb_str_new2(rubylib_mangle((s), (l))) |