Browse Source

sys_shm_open: fchmod the returned descriptor to get correct perms

this doesn't happen by default
Beau McCartney 1 year ago
parent
commit
1758bd683e
1 changed files with 4 additions and 0 deletions
  1. 4 0
      core/sys/darwin/xnu_system_call_helpers.odin

+ 4 - 0
core/sys/darwin/xnu_system_call_helpers.odin

@@ -206,5 +206,9 @@ sys_shm_open :: proc(name: string, oflag: Open_Flags, mode: Permission) -> (c.in
 	result := syscall_shm_open(cname, cmode, cflags)
 	result := syscall_shm_open(cname, cmode, cflags)
 	state  := result != -1
 	state  := result != -1
 
 
+	if state && cflags != 0 {
+		state = (syscall_fchmod(result, cflags) != -1)
+	}
+
 	return result * cast(c.int)state, state
 	return result * cast(c.int)state, state
 }
 }