From 8711c9cb47b996783ede7a96c60a39828780aa8a Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Fri, 24 Jun 2022 22:39:54 +0300 Subject: [PATCH 20/20] Fix netwait on systems with unsigned time_t See osdn #44886 Signed-off-by: Marko Lindqvist --- server/sernet.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server/sernet.c b/server/sernet.c index 059e52130f..1f730d1ace 100644 --- a/server/sernet.c +++ b/server/sernet.c @@ -359,13 +359,16 @@ void flush_packets(void) (void) time(&start); for(;;) { - tv.tv_sec = (game.server.netwait - (time(NULL) - start)); - tv.tv_usec = 0; + /* Can't assign to tv.tv_sec directly on systems where it's unsigned */ + signed signsecs = (game.server.netwait - (time(NULL) - start)); - if (tv.tv_sec < 0) { + if (signsecs < 0) { return; } + tv.tv_usec = ; + tv.tv_sec = signsecs; + FC_FD_ZERO(&writefs); FC_FD_ZERO(&exceptfs); max_desc = -1; -- 2.35.1