aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Seebach <peter.seebach@windriver.com>2015-09-22 17:49:50 -0500
committerPeter Seebach <peter.seebach@windriver.com>2015-09-22 17:49:50 -0500
commit3bc3909fa70535c2ef876009dc58e577b10a7e0e (patch)
treecaf2247111ffc6d331a0350b4a940a226bb7547e
parent3b9395ece54c7e787a7f707ccabefc5bd1b231bf (diff)
downloadpseudo-PSEUDO_1_7_4.tar.gz
pseudo-PSEUDO_1_7_4.tar.bz2
pseudo-PSEUDO_1_7_4.zip
f*open*: Use more-correct mode.pseudo-1.7.4PSEUDO_1_7_4
The f{re,}open{64,} functions use a default mode of 0666 & ~umask, and defaulting to 0600 for the post-open chmod was breaking some use cases. Problem and solution identified by Ross Burton, I just made the local copy of the patch. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
-rw-r--r--ChangeLog.txt5
-rw-r--r--Makefile.in2
-rw-r--r--ports/linux/guts/fopen64.c2
-rw-r--r--ports/linux/guts/freopen64.c2
-rw-r--r--ports/unix/guts/fopen.c2
-rw-r--r--ports/unix/guts/freopen.c2
6 files changed, 9 insertions, 6 deletions
diff --git a/ChangeLog.txt b/ChangeLog.txt
index c96166b..5431f1e 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,10 +1,13 @@
+2015-09-22:
+ * (seebs) Fix modes after fopen/fopen64.
+
2015-09-04:
* (seebs) add return value printing to wrapper debug!
* (seebs) make mkdirat() restore errno, also don't pass
AT_SYMLINK_NOFOLLOW to fchmodat() since it is ignored, and
we know that if the thing exists at all, it is a directory
and thus AT_SYMLINK_NOFOLLOW would be irrelevant anyway.
- * (seedbs) and 1.7.3, of course.
+ * (seebs) and 1.7.3, of course.
2015-09-03:
* (seebs) Use original mode, not 0600, for the chmods used to
diff --git a/Makefile.in b/Makefile.in
index 1c34824..7fa5149 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -44,7 +44,7 @@ BITS=@BITS@
ARCH_FLAGS=@ARCH_FLAGS@
MARK64=@MARK64@
RPATH=@RPATH@
-VERSION=1.7.3
+VERSION=1.7.4
LIB=@LIB@
BIN=bin
diff --git a/ports/linux/guts/fopen64.c b/ports/linux/guts/fopen64.c
index 32539ea..b243345 100644
--- a/ports/linux/guts/fopen64.c
+++ b/ports/linux/guts/fopen64.c
@@ -20,7 +20,7 @@
pseudo_debug(PDBGF_FILE, "fopen64 '%s': fd %d <FILE %p>\n", path, fd, (void *) rc);
if (real___fxstat64(_STAT_VER, fd, &buf) != -1) {
if (!existed) {
- real_fchmod(fd, PSEUDO_FS_MODE(0600, 0));
+ real_fchmod(fd, PSEUDO_FS_MODE(0666 & ~pseudo_umask, 0));
pseudo_client_op(OP_CREAT, 0, -1, -1, path, &buf);
}
pseudo_client_op(OP_OPEN, pseudo_access_fopen(mode), fd, -1, path, &buf);
diff --git a/ports/linux/guts/freopen64.c b/ports/linux/guts/freopen64.c
index b6ff0a6..4bad533 100644
--- a/ports/linux/guts/freopen64.c
+++ b/ports/linux/guts/freopen64.c
@@ -19,7 +19,7 @@
pseudo_debug(PDBGF_FILE, "freopen64 '%s': fd %d\n", path, fd);
if (real___fxstat64(_STAT_VER, fd, &buf) != -1) {
if (!existed) {
- real_fchmod(fd, PSEUDO_FS_MODE(0600, 0));
+ real_fchmod(fd, PSEUDO_FS_MODE(0666 & ~pseudo_umask, 0));
pseudo_client_op(OP_CREAT, 0, -1, -1, path, &buf);
}
pseudo_client_op(OP_OPEN, pseudo_access_fopen(mode), fd, -1, path, &buf);
diff --git a/ports/unix/guts/fopen.c b/ports/unix/guts/fopen.c
index 4214980..87c7d78 100644
--- a/ports/unix/guts/fopen.c
+++ b/ports/unix/guts/fopen.c
@@ -19,7 +19,7 @@
pseudo_debug(PDBGF_OP, "fopen '%s': fd %d <FILE %p>\n", path, fd, (void *) rc);
if (base_fstat(fd, &buf) != -1) {
if (!existed) {
- real_fchmod(fd, PSEUDO_FS_MODE(0600, 0));
+ real_fchmod(fd, PSEUDO_FS_MODE(0666 & ~pseudo_umask, 0));
pseudo_client_op(OP_CREAT, 0, -1, -1, path, &buf);
}
pseudo_client_op(OP_OPEN, pseudo_access_fopen(mode), fd, -1, path, &buf);
diff --git a/ports/unix/guts/freopen.c b/ports/unix/guts/freopen.c
index 09219be..e706d9f 100644
--- a/ports/unix/guts/freopen.c
+++ b/ports/unix/guts/freopen.c
@@ -19,7 +19,7 @@
pseudo_debug(PDBGF_OP, "freopen '%s': fd %d\n", path, fd);
if (base_fstat(fd, &buf) != -1) {
if (!existed) {
- real_fchmod(fd, PSEUDO_FS_MODE(0600, 0));
+ real_fchmod(fd, PSEUDO_FS_MODE(0666 & ~pseudo_umask, 0));
pseudo_client_op(OP_CREAT, 0, -1, -1, path, &buf);
}
pseudo_client_op(OP_OPEN, pseudo_access_fopen(mode), fd, -1, path, &buf);