diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2020-04-15 06:32:13 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2020-04-15 06:32:13 -0700 |
commit | a3d57c4d0a70adb874afc9d74321494ff9367e0f (patch) | |
tree | e86e4747771974d4b356101440d288b1597e4079 /stream.c | |
parent | 70347eef430a0dc932e4f62f3ac180138a6876e9 (diff) | |
download | txr-a3d57c4d0a70adb874afc9d74321494ff9367e0f.tar.gz txr-a3d57c4d0a70adb874afc9d74321494ff9367e0f.tar.bz2 txr-a3d57c4d0a70adb874afc9d74321494ff9367e0f.zip |
streams: bugfix: "m" mode: use 0666 in open.
* stream.c (w_fopen_mode): When the "m" mode is present such
that we resort to a combination of POSIX open and fdopen,
we must use the 0666 mode for open, not 0777. This will
create a file with execute permissions, if the umask
doesn't block it. It went unnoticed because umask is
usually 022.
Diffstat (limited to 'stream.c')
-rw-r--r-- | stream.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1089,7 +1089,7 @@ static FILE *w_fopen_mode(const wchar_t *wname, const wchar_t *mode, if (m.notrunc) { char *name = utf8_dup_to(wname); int flags = (m.read ? O_RDWR : O_WRONLY) | O_CREAT; - int fd = open(name, flags, 0777); + int fd = open(name, flags, 0666); free(name); if (fd < 0) return NULL; |