repo: ngircd
action: commit
revision: 
path_from: 
revision_from: d8aba40f07d739692cdeccbd49a1c163998945ba:
path_to: 
revision_to: 
git.thebackupbox.net
ngircd
git clone git://git.thebackupbox.net/ngircd
commit d8aba40f07d739692cdeccbd49a1c163998945ba
Author: Alexander Barton 
Date:   Sun Nov 15 15:14:12 2015 +0100

    Explicitly cast time_t to long when printing it out

    This prevents wrong sizes data types on platforms where time_t doesn't
    equal a long any more, for example on OpenBSD.

diff --git a/src/ngircd/irc-login.c b/src/ngircd/irc-login.c
index a7955b14ae3b566b832b4879f445deb2dce21c38..
index ..2a0a8fa5c2ffab0d40508f5fdfd984847c2c6b1b 100644
--- a/src/ngircd/irc-login.c
+++ b/src/ngircd/irc-login.c
@@ -873,13 +873,14 @@ IRC_PONG(CLIENT *Client, REQUEST *Req)
 	if (Client_Type(Client) == CLIENT_SERVER && Conn_LastPing(conn) == 0) {
 		Log(LOG_INFO,
 		    "Synchronization with \"%s\" done (connection %d): %ld second%s [%ld users, %ld channels].",
-		    Client_ID(Client), conn, time(NULL) - Conn_GetSignon(conn),
+		    Client_ID(Client), conn,
+		    (long)(time(NULL) - Conn_GetSignon(conn)),
 		    time(NULL) - Conn_GetSignon(conn) == 1 ? "" : "s",
 		    Client_UserCount(), Channel_CountVisible(NULL));
 		Conn_UpdatePing(conn);
 	} else
 		LogDebug("Connection %d: received PONG. Lag: %ld seconds.",
-			 conn, time(NULL) - Conn_LastPing(conn));
+			 conn, (long)(time(NULL) - Conn_LastPing(conn)));

 	return CONNECTED;
 } /* IRC_PONG */
diff --git a/src/ngircd/irc.c b/src/ngircd/irc.c
index 4c775e2dea855f669ae22e5d3e81cfe0a4b98698..
index ..cfe616f5f33ac9845c9cfbdf92392f183bfdc9a8 100644
--- a/src/ngircd/irc.c
+++ b/src/ngircd/irc.c
@@ -240,7 +240,7 @@ IRC_TRACE(CLIENT *Client, REQUEST *Req)
 					PACKAGE_VERSION, Client_ID(target),
 					Client_ID(Client_NextHop(target)),
 					Option_String(idx2),
-					time(NULL) - Conn_StartTime(idx2),
+					(long)(time(NULL) - Conn_StartTime(idx2)),
 					Conn_SendQ(idx), Conn_SendQ(idx2)))
 			return DISCONNECTED;

diff --git a/src/ngircd/numeric.c b/src/ngircd/numeric.c
index 7d32ddc933fd5fd132e4efbf74defa1c961d3fd3..
index ..82e0cf0155a0cf32c939c9078731e9d09623c18f 100644
--- a/src/ngircd/numeric.c
+++ b/src/ngircd/numeric.c
@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
+ * Copyright (c)2001-2015 Alexander Barton (alex@barton.de) and Contributors.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -185,7 +185,7 @@ Synchronize_Lists(CLIENT * Client)
 	while (elem) {
 		if (!IRC_WriteStrClient(Client, "GLINE %s %ld :%s",
 					Lists_GetMask(elem),
-					Lists_GetValidity(elem) - time(NULL),
+					(long)(Lists_GetValidity(elem) - time(NULL)),
 					Lists_GetReason(elem)))
 			return DISCONNECTED;
 		elem = Lists_GetNext(elem);
diff --git a/src/ngircd/sighandlers.c b/src/ngircd/sighandlers.c
index 5cde24b066af392e125aefa893f15a68b92ccda9..
index ..e352d586e80c9c62743b8c01ec5d0ffe354be832 100644
--- a/src/ngircd/sighandlers.c
+++ b/src/ngircd/sighandlers.c
@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
+ * Copyright (c)2001-2015 Alexander Barton (alex@barton.de) and Contributors.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -48,7 +48,11 @@ Dump_State(void)
 {
 	Log(LOG_DEBUG, "--- Internal server state: %s ---",
 	    Client_ID(Client_ThisServer()));
-	Log(LOG_DEBUG, "time()=%ld", time(NULL));
+#ifdef HAVE_LONG_LONG
+	Log(LOG_DEBUG, "time()=%llu", (unsigned long long)time(NULL));
+#else
+	Log(LOG_DEBUG, "time()=%lu", (unsigned long)time(NULL));
+#endif
 	Conf_DebugDump();
 	Conn_DebugDump();
 	Client_DebugDump();

-----END OF PAGE-----