summaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-01-09 08:04:39 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-01-09 08:04:39 +0000
commitcd1cbfceea8d6b4fae8b3e9956b0c2442b6522d3 (patch)
treea63408710544576bd3348474f737db6f6c39368f /file.c
parent9f3b8bb61f81cc0fa29b1746bf1c14f84bfbe85e (diff)
downloadruby-cd1cbfceea8d6b4fae8b3e9956b0c2442b6522d3.tar.gz
ruby-cd1cbfceea8d6b4fae8b3e9956b0c2442b6522d3.tar.xz
ruby-cd1cbfceea8d6b4fae8b3e9956b0c2442b6522d3.zip
* file.c (path_check_1): should restore modified path.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@1093 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r--file.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/file.c b/file.c
index 98098f904..db200c6f7 100644
--- a/file.c
+++ b/file.c
@@ -2029,6 +2029,7 @@ path_check_1(path)
}
for (;;) {
if (stat(path, &st) == 0 && (st.st_mode & 002)) {
+ if (p) *p = '/';
return 0;
}
s = strrchr(path, '/');
@@ -2056,7 +2057,10 @@ rb_path_check(path)
if (pend) *pend = '\0';
safe = path_check_1(p);
- if (!safe) return 0;
+ if (!safe) {
+ if (pend) *pend = sep;
+ return 0;
+ }
if (!pend) break;
*pend = sep;
p = pend + 1;