$OpenBSD: patch-common_ECLogger_cpp,v 1.7 2010/08/22 10:13:27 ajacoutot Exp $
--- common/ECLogger.cpp.orig	Tue Aug  3 14:51:42 2010
+++ common/ECLogger.cpp	Sun Aug 22 10:32:31 2010
@@ -54,6 +54,10 @@
 #include <zlib.h>
 #include <assert.h>
 
+#ifdef __OpenBSD__
+#include <signal.h>
+#endif
+
 #include "config.h"
 #if HAVE_SYSLOG_H
 #include <syslog.h>
@@ -162,7 +166,7 @@ ECLogger_File::~ECLogger_File() {
 		if (timestamp)
 			fnPrintf(log, "%s: ", MakeTimestamp());
 		if (prefix == LP_TID)
-			fnPrintf(log, "[0x%08x] ", (unsigned int)pthread_self());
+			fnPrintf(log, "[0x%08lx] ", (unsigned long)pthread_self());
 		else if (prefix == LP_PID)
 			fnPrintf(log, "[%5d] ", getpid());
 		fnPrintf(log, "Previous message logged %d times\n", prevcount);
@@ -204,7 +208,7 @@ bool ECLogger_File::DupFilter(const std::string &messa
 		if (timestamp)
 			fnPrintf(log, "%s: ", MakeTimestamp());
 		if (prefix == LP_TID)
-			fnPrintf(log, "[0x%08x] ", (unsigned int)pthread_self());
+			fnPrintf(log, "[0x%08lx] ", (unsigned long)pthread_self());
 		else if (prefix == LP_PID)
 			fnPrintf(log, "[%5d] ", getpid());
 		fnPrintf(log, "Previous message logged %d times\n", prevcount);
@@ -251,7 +255,7 @@ void ECLogger_File::Log(int loglevel, const char *form
 		if (timestamp)
 			fnPrintf(log, "%s: ", MakeTimestamp());
 		if (prefix == LP_TID)
-			fnPrintf(log, "[0x%08x] ", (unsigned int)pthread_self());
+			fnPrintf(log, "[0x%08lx] ", (unsigned long)pthread_self());
 		else if (prefix == LP_PID)
 			fnPrintf(log, "[%5d] ", getpid());
 		fnPrintf(log, "%s\n", msgbuffer);
@@ -330,7 +334,7 @@ void ECLogger_Pipe::Log(int loglevel, const std::strin
 	off += 1;
 
 	if (prefix == LP_TID)
-		len = snprintf(msgbuffer+off, _LOG_BUFSIZE -off, "[0x%08x] ", (unsigned int)pthread_self());
+		len = snprintf(msgbuffer+off, _LOG_BUFSIZE -off, "[0x%08lx] ", (unsigned long)pthread_self());
 	else if (prefix == LP_PID)
 		len = snprintf(msgbuffer+off, _LOG_BUFSIZE -off, "[%5d] ", getpid());
 	off += len;
@@ -359,7 +363,7 @@ void ECLogger_Pipe::Log(int loglevel, const char *form
 	off += 1;
 
 	if (prefix == LP_TID)
-		len = snprintf(msgbuffer+off, _LOG_BUFSIZE -off, "[0x%08x] ", (unsigned int)pthread_self());
+		len = snprintf(msgbuffer+off, _LOG_BUFSIZE -off, "[0x%08lx] ", (unsigned long)pthread_self());
 	else if (prefix == LP_PID)
 		len = snprintf(msgbuffer+off, _LOG_BUFSIZE -off, "[%5d] ", getpid());
 	off += len;
@@ -572,8 +576,8 @@ ECLogger* CreateLogger(ECConfig *lpConfig, char *argv0
 			lpLogger = new ECLogger_File(atoi(lpConfig->GetSetting("log_level")), atoi(lpConfig->GetSetting("log_timestamp")), lpConfig->GetSetting("log_file"), false);
 			// chown file
 			if (pw || gr) {
-				uid_t uid = -1;
-				gid_t gid = -1;
+				uid_t uid;
+				gid_t gid;
 				if (pw)
 					uid = pw->pw_uid;
 				if (gr)
