summaryrefslogtreecommitdiff
path: root/os2
diff options
context:
space:
mode:
authorIlya Zakharevich <ilya@math.berkeley.edu>2001-07-02 11:45:41 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2001-07-02 19:18:28 +0000
commit45ee47cb1378c6ab197f2fd2990dd53283edcaab (patch)
tree581d1d2a62948b0882641648495c097a53ffbb9d /os2
parent52781dca2944c497b57c8b793a54a3999afdfa6d (diff)
downloadperl-45ee47cb1378c6ab197f2fd2990dd53283edcaab.tar.gz
Re: [PATCH 5.6.1] OS/2 cwd
Message-ID: <20010702154541.B24295@math.ohio-state.edu> p4raw-id: //depot/perl@11106
Diffstat (limited to 'os2')
-rw-r--r--os2/os2.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/os2/os2.c b/os2/os2.c
index d7d208e83b..bfe6e9f2c5 100644
--- a/os2/os2.c
+++ b/os2/os2.c
@@ -2074,17 +2074,22 @@ XS(XS_Cwd_sys_abspath)
l--;
ST(0) = sv_newmortal();
sv_setpvn( sv = (SV*)ST(0), RETVAL, l);
- /* Remove duplicate slashes */
- s = t = 1 + SvPV_force(sv, n_a);
+ /* Remove duplicate slashes, skipping the first three, which
+ may be parts of a server-based path */
+ s = t = 3 + SvPV_force(sv, n_a);
e = SvEND(sv);
+ /* Do not worry about multibyte chars here, this would contradict the
+ eventual UTFization, and currently most other places break too... */
while (s < e) {
if (s[0] == t[-1] && s[0] == '/')
s++; /* Skip duplicate / */
else
*t++ = *s++;
}
- *s = 0;
- SvCUR_set(sv, s - SvPVX(sv));
+ if (t < e) {
+ *t = 0;
+ SvCUR_set(sv, t - SvPVX(sv));
+ }
}
XSRETURN(1);
}