changeset 6232:8f5f0fc38758 draft

(svn r9035) -Fix [SunOS]: Solaris sometimes has pid_t defined as long. Fix warnings in those cases
author truelight <truelight@openttd.org>
date Tue, 06 Mar 2007 21:14:48 +0000
parents a4e11dd2d7c6
children 44af8f27045c
files src/dedicated.cpp
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/dedicated.cpp
+++ b/src/dedicated.cpp
@@ -14,6 +14,14 @@
 #include <sys/types.h>
 #include <unistd.h>
 
+#if defined(SUNOS) && !defined(_LP64) && !defined(_I32LPx)
+/* Solaris has, in certain situation, pid_t defined as long, while in other
+ *  cases it has it defined as int... this handles all cases nicely. */
+# define PRINTF_PID_T "%ld"
+#else
+# define PRINTF_PID_T "%d"
+#endif
+
 void DedicatedFork(void)
 {
 	/* Fork the program */
@@ -47,7 +55,7 @@
 		default:
 			/* We're the parent */
 			printf("Loading dedicated server...\n");
-			printf("  - Forked to background with pid %d\n", pid);
+			printf("  - Forked to background with pid " PRINTF_PID_T "\n", pid);
 			exit(0);
 	}
 }