Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace calls to putenv with setenv #18530

Merged
merged 7 commits into from
Jul 23, 2021
Merged
6 changes: 3 additions & 3 deletions lib/pure/includes/osenv.nim
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ else:

proc c_getenv(env: cstring): cstring {.
importc: "getenv", header: "<stdlib.h>".}
proc c_putenv(env: cstring): cint {.
importc: "putenv", header: "<stdlib.h>".}
proc c_setenv(envname: cstring, envval: cstring, overwrite: cint): cint {.
importc: "setenv", header: "<stdlib.h>".}
proc c_unsetenv(env: cstring): cint {.
importc: "unsetenv", header: "<stdlib.h>".}
brightly-salty marked this conversation as resolved.
Show resolved Hide resolved

Expand Down Expand Up @@ -221,7 +221,7 @@ else:
else:
if setEnvironmentVariableA(key, val) == 0'i32: raiseOSError(osLastError())
else:
if c_putenv(environment[indx]) != 0'i32:
if c_setenv(key, val, 1'i32) != 0'i32:
raiseOSError(osLastError())

proc delEnv*(key: string) {.tags: [WriteEnvEffect].} =
Expand Down