aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--os-win32.c15
-rw-r--r--osdep.h2
2 files changed, 17 insertions, 0 deletions
diff --git a/os-win32.c b/os-win32.c
index d98fd77c12..dd46bf459d 100644
--- a/os-win32.c
+++ b/os-win32.c
@@ -34,6 +34,21 @@
#include "qemu-options.h"
/***********************************************************/
+/* Functions missing in mingw */
+
+int setenv(const char *name, const char *value, int overwrite)
+{
+ int result = 0;
+ if (overwrite || !getenv(name)) {
+ size_t length = strlen(name) + strlen(value) + 2;
+ char *string = qemu_malloc(length);
+ snprintf(string, length, "%s=%s", name, value);
+ result = putenv(string);
+ }
+ return result;
+}
+
+/***********************************************************/
/* Polling handling */
typedef struct PollingEntry {
diff --git a/osdep.h b/osdep.h
index 75b581630f..1cdc7e2e3e 100644
--- a/osdep.h
+++ b/osdep.h
@@ -95,6 +95,8 @@ int qemu_create_pidfile(const char *filename);
#ifdef _WIN32
int ffs(int i);
+int setenv(const char *name, const char *value, int overwrite);
+
typedef struct {
long tv_sec;
long tv_usec;