poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GNU poke 2.0.91 pre-released in alpha.gnu.org


From: Jose E. Marchesi
Subject: Re: GNU poke 2.0.91 pre-released in alpha.gnu.org
Date: Sat, 05 Feb 2022 02:42:36 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Hi Bruno.

> On macOS 12.2/arm64:
> Builds fine, with many warnings, mostly from jitter. Log attached.

One of the warnings was about passing a pointer to `struct sockaddr_in'
to getsockname.

I fixed it in the patch below by explicitly casting to the expected type
(which I am pretty sure is valid, I'm no networking hacker though...)

Tangentially I also imported the gnulib getsockname module, since we
weren't using it before.


diff --git a/ChangeLog b/ChangeLog
index d2131591..61dd5504 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2022-02-05  Jose E. Marchesi  <jemarch@gnu.org>
 
+       * bootstrap.conf (gnulib_modules): Add the `getsockname' gnulib
+       module.
+       * poke/pk-hserver.c (pk_hserver_start): Cast the pointer to
+       `struct sockaddr_in' to a pointer to a `strut sockaddr_in' before
+       passing it to getsockname.  This avoids compiler warnings in some
+       platforms.
+
+2022-02-05  Jose E. Marchesi  <jemarch@gnu.org>
+
        * testsuite/lib/poke.exp (verify_exit_status): Avoid using
        lassign.
 
diff --git a/bootstrap.conf b/bootstrap.conf
index fd0a8ff5..26b13aba 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -31,6 +31,7 @@ gnulib_modules="
   gendocs
   gethostname
   getline
+  getsockname
   getopt-gnu
   glob
   host-cpu-c-abi
diff --git a/poke/pk-hserver.c b/poke/pk-hserver.c
index 461508fd..14b4c5e3 100644
--- a/poke/pk-hserver.c
+++ b/poke/pk-hserver.c
@@ -381,7 +381,9 @@ pk_hserver_start (void)
      hserver_port_str.  These will be used until the server shuts
      down.  */
   size = sizeof (clientname);
-  if (getsockname (hserver_socket, &clientname, &size) != 0)
+  if (getsockname (hserver_socket,
+                   (struct sockaddr *) &clientname,
+                   &size) != 0)
     {
       perror ("getsockname");
       pk_fatal (NULL);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]