From 38a9a2b7fc0b0430b7a664719d4ce2e6bf836256 Mon Sep 17 00:00:00 2001 From: Justas Dabrila Date: Mon, 23 Dec 2019 16:35:10 +0200 Subject: [PATCH] Linux: write_entire_file sets 644 permissions on open. --- core/os/os.odin | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/os/os.odin b/core/os/os.odin index d5ac23b62..11cc59a8f 100644 --- a/core/os/os.odin +++ b/core/os/os.odin @@ -99,7 +99,14 @@ write_entire_file :: proc(name: string, data: []byte, truncate := true) -> (succ if truncate { flags |= O_TRUNC; } - fd, err := open(name, flags, 0); + + mode: int = 0; + when OS == "linux" { + // NOTE(justasd): 644 (owner read, write; group read; others read) + mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH; + } + + fd, err := open(name, flags, mode); if err != 0 { return false; }