summaryrefslogtreecommitdiffstats
path: root/stream.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-04-15 06:32:13 -0700
committerKaz Kylheku <kaz@kylheku.com>2020-04-15 06:32:13 -0700
commita3d57c4d0a70adb874afc9d74321494ff9367e0f (patch)
treee86e4747771974d4b356101440d288b1597e4079 /stream.c
parent70347eef430a0dc932e4f62f3ac180138a6876e9 (diff)
downloadtxr-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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/stream.c b/stream.c
index 8856d9b8..a8177ff3 100644
--- a/stream.c
+++ b/stream.c
@@ -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;