diff options
Diffstat (limited to 'ports')
-rw-r--r-- | ports/darwin/guts/open.c | 2 | ||||
-rw-r--r-- | ports/linux/guts/__xmknodat.c | 1 | ||||
-rw-r--r-- | ports/linux/guts/openat.c | 2 | ||||
-rw-r--r-- | ports/unix/guts/mkdirat.c | 5 | ||||
-rw-r--r-- | ports/unix/guts/mkfifoat.c | 2 | ||||
-rw-r--r-- | ports/unix/guts/mknodat.c | 1 |
6 files changed, 11 insertions, 2 deletions
diff --git a/ports/darwin/guts/open.c b/ports/darwin/guts/open.c index 0979c54..f34b0d3 100644 --- a/ports/darwin/guts/open.c +++ b/ports/darwin/guts/open.c @@ -41,7 +41,7 @@ if (stat_rc != -1) { buf.st_mode = PSEUDO_DB_MODE(buf.st_mode, mode); if (!existed) { - real_fchmod(rc, PSEUDO_FS_MODE(0600, 0)); + real_fchmod(rc, PSEUDO_FS_MODE(mode, 0)); pseudo_client_op(OP_CREAT, 0, -1, -1, path, &buf); } pseudo_client_op(OP_OPEN, PSEUDO_ACCESS(flags), rc, -1, path, &buf); diff --git a/ports/linux/guts/__xmknodat.c b/ports/linux/guts/__xmknodat.c index 0888b8a..296918a 100644 --- a/ports/linux/guts/__xmknodat.c +++ b/ports/linux/guts/__xmknodat.c @@ -43,6 +43,7 @@ if (rc == -1) { return -1; } + real_fchmod(rc, PSEUDO_FS_MODE(mode, 0)); real___fxstat64(_STAT_VER, rc, &buf); /* mknod does not really open the file. We don't have * to use wrap_close because we've never exposed this file diff --git a/ports/linux/guts/openat.c b/ports/linux/guts/openat.c index 338bd45..eb7c0b5 100644 --- a/ports/linux/guts/openat.c +++ b/ports/linux/guts/openat.c @@ -75,7 +75,7 @@ if (stat_rc != -1) { buf.st_mode = PSEUDO_DB_MODE(buf.st_mode, mode); if (!existed) { - real_fchmod(rc, PSEUDO_FS_MODE(0600, 0)); + real_fchmod(rc, PSEUDO_FS_MODE(mode, 0)); pseudo_client_op(OP_CREAT, 0, -1, dirfd, path, &buf); } pseudo_client_op(OP_OPEN, PSEUDO_ACCESS(flags), rc, dirfd, path, &buf); diff --git a/ports/unix/guts/mkdirat.c b/ports/unix/guts/mkdirat.c index 5f80b50..668d6ac 100644 --- a/ports/unix/guts/mkdirat.c +++ b/ports/unix/guts/mkdirat.c @@ -30,6 +30,11 @@ if (stat_rc != -1) { buf.st_mode = PSEUDO_DB_MODE(buf.st_mode, mode); pseudo_client_op(OP_MKDIR, 0, -1, dirfd, path, &buf); +#ifdef PSEUDO_NO_REAL_AT_FUNCTIONS + real_fchmod(path, PSEUDO_FS_MODE(mode, 1)); +#else + real_fchmodat(dirfd, path, PSEUDO_FS_MODE(mode, 1), AT_SYMLINK_NOFOLLOW); +#endif } else { pseudo_debug(PDBGF_OP, "mkdir of %s succeeded, but stat failed: %s\n", path, strerror(errno)); diff --git a/ports/unix/guts/mkfifoat.c b/ports/unix/guts/mkfifoat.c index 4101a72..4546ba3 100644 --- a/ports/unix/guts/mkfifoat.c +++ b/ports/unix/guts/mkfifoat.c @@ -34,12 +34,14 @@ return -1; } rc = base_stat(path, &buf); + real_chmod(path, PSEUDO_FS_MODE(mode, 0)); #else rc = real_mkfifoat(dirfd, path, PSEUDO_FS_MODE(mode, 0)); if (rc == -1) { return -1; } rc = base_fstatat(dirfd, path, &buf, AT_SYMLINK_NOFOLLOW); + real_fchmodat(dirfd, path, PSEUDO_FS_MODE(mode, 0), AT_SYMLINK_NOFOLLOW); #endif /* if the stat failed, we are going to give up and nuke * any file we may have created, and hope for the best. diff --git a/ports/unix/guts/mknodat.c b/ports/unix/guts/mknodat.c index 5d8d47c..76e4dd9 100644 --- a/ports/unix/guts/mknodat.c +++ b/ports/unix/guts/mknodat.c @@ -37,6 +37,7 @@ if (rc == -1) { return -1; } + real_fchmod(rc, PSEUDO_FS_MODE(mode, 0)); base_fstat(rc, &buf); /* mknod does not really open the file. We don't have * to use wrap_close because we've never exposed this file |