aboutsummaryrefslogtreecommitdiffstats
path: root/ports/unix
diff options
context:
space:
mode:
Diffstat (limited to 'ports/unix')
-rw-r--r--ports/unix/guts/mkdirat.c3
-rw-r--r--ports/unix/guts/mknodat.c3
-rw-r--r--ports/unix/guts/umask.c14
-rw-r--r--ports/unix/wrapfuncs.in1
4 files changed, 21 insertions, 0 deletions
diff --git a/ports/unix/guts/mkdirat.c b/ports/unix/guts/mkdirat.c
index 5f97ab5..dceedeb 100644
--- a/ports/unix/guts/mkdirat.c
+++ b/ports/unix/guts/mkdirat.c
@@ -11,6 +11,9 @@
errno = ENOSYS;
return -1;
}
+ /* mask out mode bits appropriately */
+ mode = mode & ~pseudo_umask;
+
rc = real_mkdir(path, PSEUDO_FS_MODE(mode, 1));
#else
rc = real_mkdirat(dirfd, path, PSEUDO_FS_MODE(mode, 1));
diff --git a/ports/unix/guts/mknodat.c b/ports/unix/guts/mknodat.c
index 6fd5b42..5d8d47c 100644
--- a/ports/unix/guts/mknodat.c
+++ b/ports/unix/guts/mknodat.c
@@ -10,6 +10,9 @@
PSEUDO_STATBUF buf;
int save_errno = errno;
+ /* mask out mode bits appropriately */
+ mode = mode & ~pseudo_umask;
+
#ifdef PSEUDO_NO_REAL_AT_FUNCTIONS
if (dirfd != AT_FDCWD) {
errno = ENOSYS;
diff --git a/ports/unix/guts/umask.c b/ports/unix/guts/umask.c
new file mode 100644
index 0000000..6b060d3
--- /dev/null
+++ b/ports/unix/guts/umask.c
@@ -0,0 +1,14 @@
+/*
+ * Copyright (c) 2014 Wind River Systems; see
+ * guts/COPYRIGHT for information.
+ *
+ * mode_t umask(mode_t mask)
+ * mode_t rc = 0;
+ */
+
+ pseudo_umask = mask;
+ rc = real_umask(mask);
+
+/* return rc;
+ * }
+ */
diff --git a/ports/unix/wrapfuncs.in b/ports/unix/wrapfuncs.in
index 8460a65..e0e9739 100644
--- a/ports/unix/wrapfuncs.in
+++ b/ports/unix/wrapfuncs.in
@@ -67,3 +67,4 @@ void sync(void); /* async_skip= */
int syncfs(int fd); /* async_skip=0 */
int sync_file_range(int fd, off64_t offset, off64_t nbytes, unsigned int flags); /* async_skip=0 */
int msync(void *addr, size_t length, int flags); /* async_skip=0 */
+mode_t umask(mode_t mask);