Mercurial > hg > dhcpcd
changeset 4931:ebcc4f883a5c draft
eloop: fix some warnings
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Tue, 07 Jan 2020 22:49:34 +0000 |
| parents | ab0e8eeeb8ca |
| children | 8e1948e75f39 |
| files | src/eloop.c |
| diffstat | 1 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/eloop.c Tue Jan 07 22:38:40 2020 +0000 +++ b/src/eloop.c Tue Jan 07 22:49:34 2020 +0000 @@ -1000,7 +1000,6 @@ 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 @@ #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 @@ } 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 @@ 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
