mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 23:58:50 +00:00
Linux: write_entire_file sets 644 permissions on open.
This commit is contained in:
+8
-1
@@ -99,7 +99,14 @@ write_entire_file :: proc(name: string, data: []byte, truncate := true) -> (succ
|
|||||||
if truncate {
|
if truncate {
|
||||||
flags |= O_TRUNC;
|
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 {
|
if err != 0 {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user