From f6812f293da04900c041f4636d458ea3bd38aaea Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Fri, 24 Jun 2022 22:32:02 +0300 Subject: [PATCH 64/64] 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 a344a7a856..9a53f4eb5e 100644 --- a/server/sernet.c +++ b/server/sernet.c @@ -361,13 +361,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 = 0; + tv.tv_sec = signsecs; + FC_FD_ZERO(&writefs); FC_FD_ZERO(&exceptfs); max_desc = -1; -- 2.35.1