Skip to content

Commit

Permalink
unsetenv for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
perazz committed Jun 24, 2024
1 parent a65d1a4 commit 4843a06
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/fpm_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ int c_setenv(const char *envname, const char *envval, int overwrite) {
if(!overwrite) {
size_t envsize = 0;
errcode = getenv_s(&envsize, NULL, 0, envname);
if(errcode || envsize) return errcode;
if (errcode || envsize) return errcode;
}
return _putenv_s(envname, envval);
#endif
Expand All @@ -38,7 +38,11 @@ int c_setenv(const char *envname, const char *envval, int overwrite) {
/// @param envname: points to a string containing the name of an environment variable.
/// @return success flag, 0 on successful execution
int c_unsetenv(const char *envname) {
#ifndef _WIN32
return unsetenv(envname);
#else
return _putenv_s(envname,NULL);
#endif
}


0 comments on commit 4843a06

Please sign in to comment.