diff options
Diffstat (limited to 'lib/poll.c')
-rw-r--r-- | lib/poll.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/poll.c b/lib/poll.c index a0dc2c5226..941fecf2d3 100644 --- a/lib/poll.c +++ b/lib/poll.c @@ -396,14 +396,15 @@ poll (struct pollfd *pfd, nfds_t nfd, int timeout) if (timeout == 0) { ptv = &tv; - ptv->tv_sec = 0; - ptv->tv_usec = 0; + tv = (struct timeval) {0}; } else if (timeout > 0) { ptv = &tv; - ptv->tv_sec = timeout / 1000; - ptv->tv_usec = (timeout % 1000) * 1000; + tv = (struct timeval) { + .tv_sec = timeout / 1000, + .tv_usec = (timeout % 1000) * 1000; + }; } else if (timeout == INFTIM) /* wait forever */ |