From: Roy Marples Date: Tue, 7 Jan 2020 22:49:34 +0000 (+0000) Subject: eloop: fix some warnings X-Git-Tag: v9.0.0~148 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dee1e458a45a17ea090b18262dc8cabeb3c7eb7c;p=thirdparty%2Fdhcpcd.git eloop: fix some warnings --- diff --git a/src/eloop.c b/src/eloop.c index e072fc24..5a710aec 100644 --- a/src/eloop.c +++ b/src/eloop.c @@ -1000,7 +1000,6 @@ eloop_start(struct eloop *eloop, sigset_t *signals) int n; struct eloop_event *e; struct eloop_timeout *t; - struct timespec ts, *tsp; void (*t0)(void *); #if defined(HAVE_KQUEUE) struct kevent ke; @@ -1008,6 +1007,9 @@ eloop_start(struct eloop *eloop, sigset_t *signals) #elif defined(HAVE_EPOLL) struct epoll_event epe; #endif +#if defined(HAVE_KQUEUE) || defined(HAVE_POLL) + struct timespec ts, *tsp; +#endif #ifndef HAVE_KQUEUE int timeout; #endif @@ -1041,6 +1043,7 @@ eloop_start(struct eloop *eloop, sigset_t *signals) } if (t != NULL) { +#if defined(HAVE_KQUEUE) || defined(HAVE_POLL) if (t->seconds > INT_MAX) { ts.tv_sec = (time_t)INT_MAX; ts.tv_nsec = 0; @@ -1049,18 +1052,22 @@ eloop_start(struct eloop *eloop, sigset_t *signals) ts.tv_nsec = t->nseconds; } tsp = &ts; +#endif #ifndef HAVE_KQUEUE if (t->seconds > INT_MAX / 1000 || - t->seconds == INT_MAX / 1000 && - ((t->nseconds + 999999) / 1000000 > INT_MAX % 1000000)) + (t->seconds == INT_MAX / 1000 && + ((t->nseconds + 999999) / 1000000 + > INT_MAX % 1000000))) timeout = INT_MAX; else timeout = (int)(t->seconds * 1000 + (t->nseconds + 999999) / 1000000); #endif } else { +#if defined(HAVE_KQUEUE) || defined(HAVE_POLL) tsp = NULL; +#endif #ifndef HAVE_KQUEUE timeout = -1; #endif