aboutsummaryrefslogtreecommitdiffstats
path: root/ports/unix/guts
diff options
context:
space:
mode:
Diffstat (limited to 'ports/unix/guts')
-rw-r--r--ports/unix/guts/fchmod.c2
-rw-r--r--ports/unix/guts/fchmodat.c4
-rw-r--r--ports/unix/guts/mkdirat.c4
-rw-r--r--ports/unix/guts/mknodat.c5
4 files changed, 8 insertions, 7 deletions
diff --git a/ports/unix/guts/fchmod.c b/ports/unix/guts/fchmod.c
index 40f62ba..7c6a6ad 100644
--- a/ports/unix/guts/fchmod.c
+++ b/ports/unix/guts/fchmod.c
@@ -16,7 +16,7 @@
}
buf.st_mode = (buf.st_mode & ~07777) | (mode & 07777);
msg = pseudo_client_op_plain(OP_FCHMOD, 0, fd, -1, 0, &buf);
- real_fchmod(fd, PSEUDO_FS_MODE(mode));
+ real_fchmod(fd, PSEUDO_FS_MODE(mode, S_ISDIR(buf.st_mode)));
if (msg && msg->result != RESULT_SUCCEED) {
errno = EPERM;
rc = -1;
diff --git a/ports/unix/guts/fchmodat.c b/ports/unix/guts/fchmodat.c
index 531345d..5095c77 100644
--- a/ports/unix/guts/fchmodat.c
+++ b/ports/unix/guts/fchmodat.c
@@ -47,9 +47,9 @@
#ifdef PSEUDO_NO_REAL_AT_FUNCTIONS
/* note: if path was a symlink, and AT_NOFOLLOW_SYMLINKS was
* specified, we already bailed previously. */
- real_chmod(path, PSEUDO_FS_MODE(mode));
+ real_chmod(path, PSEUDO_FS_MODE(mode, S_ISDIR(buf.st_mode)));
#else
- real_fchmodat(dirfd, path, PSEUDO_FS_MODE(mode), flags);
+ real_fchmodat(dirfd, path, PSEUDO_FS_MODE(mode, S_ISDIR(buf.st_mode)), flags);
#endif
/* we ignore a failure from underlying fchmod, because pseudo
* may believe you are permitted to change modes that the filesystem
diff --git a/ports/unix/guts/mkdirat.c b/ports/unix/guts/mkdirat.c
index a3d3ca7..97141fc 100644
--- a/ports/unix/guts/mkdirat.c
+++ b/ports/unix/guts/mkdirat.c
@@ -11,9 +11,9 @@
errno = ENOSYS;
return -1;
}
- rc = real_mkdir(path, PSEUDO_FS_MODE(mode));
+ rc = real_mkdir(path, PSEUDO_FS_MODE(mode, 1));
#else
- rc = real_mkdirat(dirfd, path, PSEUDO_FS_MODE(mode));
+ rc = real_mkdirat(dirfd, path, PSEUDO_FS_MODE(mode, 1));
#endif
if (rc != -1) {
struct stat buf;
diff --git a/ports/unix/guts/mknodat.c b/ports/unix/guts/mknodat.c
index 22fe5ce..2b24cd0 100644
--- a/ports/unix/guts/mknodat.c
+++ b/ports/unix/guts/mknodat.c
@@ -24,10 +24,11 @@
return -1;
}
#ifdef PSEUDO_NO_REAL_AT_FUNCTIONS
- rc = real_open(path, O_CREAT | O_WRONLY | O_EXCL, PSEUDO_FS_MODE(mode));
+ rc = real_open(path, O_CREAT | O_WRONLY | O_EXCL,
+ PSEUDO_FS_MODE(mode, 0));
#else
rc = real_openat(dirfd, path, O_CREAT | O_WRONLY | O_EXCL,
- PSEUDO_FS_MODE(mode));
+ PSEUDO_FS_MODE(mode, 0));
#endif
if (rc == -1) {
return -1;