diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-01-21 22:55:44 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-01-21 22:55:44 +0000 |
commit | 16ac3975a67d58c2f3ad7448ff2401f16ee7b1b1 (patch) | |
tree | 46695dd3faefad0e8d6ba76205f65e9b6f8487e9 /pp_sys.c | |
parent | 6a8700557c79a9b2be044b86f5d782994fe99d1c (diff) | |
download | perl-16ac3975a67d58c2f3ad7448ff2401f16ee7b1b1.tar.gz |
Tweak the mkdir trailing slash code some more.
TO DO: the same handling should probably be done for
all the other filesystem functions that can have directories
as their arguments.
p4raw-id: //depot/perl@8509
Diffstat (limited to 'pp_sys.c')
-rw-r--r-- | pp_sys.c | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -3600,10 +3600,18 @@ PP(pp_mkdir) tmps = SvPV(TOPs, len); /* Different operating and file systems take differently to - * trailing slashes. To err on the side of portability, we - * snip away one trailing slash. */ - if (tmps[len-1] == '/') { - tmps = savepvn(tmps, len - 1); + * trailing slashes. According to POSIX 1003.1 1996 Edition + * any number of trailing slashes should be allowed. + * Thusly we snip them away so that even non-conforming + * systems are happy. */ + /* We should probably do this "filtering" for all + * the functions that expect (potentially) directory names: + * -d, chdir(), chmod(), chown(), chroot(), fcntl()?, + * (mkdir()), opendir(), rename(), rmdir(), stat(). --jhi */ + if (len > 1 && tmps[len-1] == '/') { + while (tmps[len] == '/' && len > 1) + len--; + tmps = savepvn(tmps, len); copy = TRUE; } |