Add Error to os2.set_env

This commit is contained in:
gingerBill
2025-02-28 13:52:51 +00:00
parent b3bbb00f1a
commit 79944056b9
5 changed files with 32 additions and 43 deletions
+6 -4
View File
@@ -26,13 +26,15 @@ _lookup_env :: proc(key: string, allocator: runtime.Allocator) -> (value: string
return
}
_set_env :: proc(key, value: string) -> (ok: bool) {
_set_env :: proc(key, value: string) -> (err: Error) {
TEMP_ALLOCATOR_GUARD()
ckey := strings.clone_to_cstring(key, temp_allocator())
cval := strings.clone_to_cstring(key, temp_allocator())
ckey := strings.clone_to_cstring(key, temp_allocator()) or_return
cval := strings.clone_to_cstring(key, temp_allocator()) or_return
ok = posix.setenv(ckey, cval, true) == .OK
if posix.setenv(ckey, cval, true) != nil {
err = _get_platform_error_from_errno()
}
return
}