summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'file.c')
-rw-r--r--file.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/file.c b/file.c
index cc443c950f..7fbe26001b 100644
--- a/file.c
+++ b/file.c
@@ -2307,13 +2307,12 @@ path_check_1(path)
#ifndef S_IWOTH
# define S_IWOTH 002
#endif
- if (stat(p0, &st) == 0 && S_ISDIR(st.st_mode) && (st.st_mode & S_IWOTH)
+ if (stat(p0, &st) == 0 && S_ISDIR(st.st_mode) && (st.st_mode & S_IWOTH)) {
#ifdef S_ISVTX
- && !(st.st_mode & S_ISVTX)
+ if (!p || !(st.st_mode & S_ISVTX))
#endif
- ) {
+ rb_warn("Unsecure world writeable dir %s , mode 0%o", p0, st.st_mode);
if (p) *p = '/';
- rb_warn("Unsecure world writeable dir %s , mode 0%o", p0, st.st_mode);
return 0;
}
s = strrdirsep(p0);