]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
tools: MSVC compile fixes
authorRalf Habacker <ralf.habacker@freenet.de>
Tue, 28 Apr 2015 18:11:27 +0000 (20:11 +0200)
committerRalf Habacker <ralf.habacker@freenet.de>
Fri, 1 May 2015 21:10:12 +0000 (23:10 +0200)
unistd.h and sleep() are normally Unix-specific, although mingw also provides them.
The Windows C runtime documents _environ as its equivalent of Unix environ.

https://bugs.freedesktop.org/show_bug.cgi?id=90089
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
tools/dbus-echo.c
tools/dbus-update-activation-environment.c

index 689c1b844a63a0376d47165f485fa875652f9a51..0e7de1bdd4d8c1ee413d2f143cd49dd4d9d016a9 100644 (file)
@@ -26,7 +26,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 
 #include <dbus/dbus.h>
 
@@ -231,7 +233,7 @@ dbus_test_tool_black_hole (int argc, char **argv)
   if (noread)
     {
       while (1)
-        sleep (3600);
+        _dbus_sleep_milliseconds (3600);
     }
 
   noreply = TRUE;
index 56d3b20d7944eb5559e7c743cb03a6d87c2ff203..6c53d8e20bac17cbbb2969edf0d35a714d47083a 100644 (file)
 # define EX_OSERR 71
 #endif
 
-/* apparently this is the portable way to get the entire environment... */
+#ifdef DBUS_WIN
+/* The Windows C runtime uses a different name */
+#define environ _environ
+#else
+/* apparently this is the portable way to get the entire environment...
+ * GNU platforms also put it in unistd.h but that's not portable */
 extern char **environ;
+#endif
 
 /* we don't really have anything useful to say about the stage at which we
  * failed */