summaryrefslogtreecommitdiff
path: root/src/win32
diff options
context:
space:
mode:
authorPaul Betts <paul@paulbetts.org>2011-09-19 10:34:52 -0700
committerPaul Betts <paul@paulbetts.org>2011-09-19 10:34:52 -0700
commit222d057c2228b7b19d198c3e36d036f3186b5b90 (patch)
treea4e93e79f428c0aa1598abff55b993133f286c99 /src/win32
parent71a4c1f16ffc71bced673c5883d5ea621cc8d24f (diff)
downloadlibgit2-222d057c2228b7b19d198c3e36d036f3186b5b90.tar.gz
Create cross-platform setenv
Diffstat (limited to 'src/win32')
-rw-r--r--src/win32/posix.c8
-rw-r--r--src/win32/posix.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/src/win32/posix.c b/src/win32/posix.c
index 38e505e20..8038fdea2 100644
--- a/src/win32/posix.c
+++ b/src/win32/posix.c
@@ -252,3 +252,11 @@ int p_mkstemp(char *tmp_path)
return p_creat(tmp_path, 0744);
}
+
+int p_setenv(const char* name, const char* value, int overwrite)
+{
+ if (overwrite != 1)
+ return EINVAL;
+
+ return (SetEnvironmentVariableA(name, value) == 0 ? GIT_EOSERR : GIT_SUCCESS);
+}
diff --git a/src/win32/posix.h b/src/win32/posix.h
index db4ec19ec..58fd05007 100644
--- a/src/win32/posix.h
+++ b/src/win32/posix.h
@@ -32,5 +32,6 @@ extern char *p_realpath(const char *orig_path, char *buffer);
extern int p_vsnprintf(char *buffer, size_t count, const char *format, va_list argptr);
extern int p_snprintf(char *buffer, size_t count, const char *format, ...) GIT_FORMAT_PRINTF(3, 4);
extern int p_mkstemp(char *tmp_path);
+extern int p_setenv(const char* name, const char* value, int overwrite);
#endif