Change to Permissions bit_set from relying on octal numbering for os2

This commit is contained in:
gingerBill
2025-10-31 14:45:53 +00:00
parent d374dc3c99
commit b9df67f8c5
14 changed files with 88 additions and 44 deletions
+2 -2
View File
@@ -7,7 +7,7 @@ MAX_ATTEMPTS :: 1<<13 // Should be enough for everyone, right?
// Creates a new temperatory file in the directory `dir`.
//
// Opens the file for reading and writing, with 0o666 permissions, and returns the new `^File`.
// Opens the file for reading and writing, with `Permissions_Read_Write_All` permissions, and returns the new `^File`.
// The filename is generated by taking a pattern, and adding a randomized string to the end.
// If the pattern includes an "*", the random string replaces the last "*".
// If `dir` is an empty string, `temp_directory()` will be used.
@@ -26,7 +26,7 @@ create_temp_file :: proc(dir, pattern: string) -> (f: ^File, err: Error) {
attempts := 0
for {
name := concatenate_strings_from_buffer(name_buf[:], prefix, random_string(rand_buf[:]), suffix)
f, err = open(name, {.Read, .Write, .Create, .Excl}, 0o666)
f, err = open(name, {.Read, .Write, .Create, .Excl}, Permissions_Read_Write_All)
if err == .Exist {
close(f)
attempts += 1