Changeset - r6232:f8ab32fb5f22
[Not reviewed]
master
0 1 0
truelight - 17 years ago 2007-03-06 21:14:48
truelight@openttd.org
(svn r9035) -Fix [SunOS]: Solaris sometimes has pid_t defined as long. Fix warnings in those cases
1 file changed with 9 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/dedicated.cpp
Show inline comments
 
@@ -11,12 +11,20 @@
 
#include "openttd.h"
 
#include "variables.h"
 

	
 
#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 */
 
	pid_t pid = fork();
 
	switch (pid) {
 
		case -1:
 
@@ -44,13 +52,13 @@ void DedicatedFork(void)
 
			break;
 
		}
 

	
 
		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);
 
	}
 
}
 
#endif
 

	
 
#else
0 comments (0 inline, 0 general)