Paul Eggert wrote:
> 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 */

This produces a syntax error on AIX:

        source='../../gllib/poll.c' object='poll.o' libtool=no  DEPDIR=.deps 
depmode=xlc /bin/sh ../../build-aux/depcomp  xlc -q64 -qthreaded -qtls 
-DHAVE_CONFIG_H -I. -I../../gllib -I..  -DGNULIB_STRICT_CHECKING=1  
-I/home/haible/prefix64/include -D_THREAD_SAFE  -g -c -o poll.o 
../../gllib/poll.c
"../../gllib/poll.c", line 406.43: 1506-275 (S) Unexpected text ';' encountered.
make: 1254-004 The error code from the last command is 1.

Fixed as follows.


2023-05-15  Bruno Haible  <br...@clisp.org>

        poll: Fix syntax error (regression from yesterday).
        * lib/poll.c (poll): Remove semicolon inside braces.

diff --git a/lib/poll.c b/lib/poll.c
index 941fecf2d3..ec8d2c2b55 100644
--- a/lib/poll.c
+++ b/lib/poll.c
@@ -403,7 +403,7 @@ poll (struct pollfd *pfd, nfds_t nfd, int timeout)
       ptv = &tv;
       tv = (struct timeval) {
         .tv_sec = timeout / 1000,
-        .tv_usec = (timeout % 1000) * 1000;
+        .tv_usec = (timeout % 1000) * 1000
       };
     }
   else if (timeout == INFTIM)




Reply via email to