I pushed the attached patch to silence this warning:

    $ gnulib-tool --create-testdir --dir testdir1 crypto/sha3
    $ cd testdir1
    $ ./configure --with-linux-crypto CFLAGS='-Wzero-as-null-pointer-constant'
    [...]
    gcc -DHAVE_CONFIG_H -I. -I..  -DGNULIB_STRICT_CHECKING=1   
-Wzero-as-null-pointer-constant -MT af_alg.o -MD -MP -MF .deps/af_alg.Tpo -c -o 
af_alg.o af_alg.c
    af_alg.c: In function ‘alg_socket’:
    af_alg.c:57:36: warning: zero as null pointer constant 
[-Wzero-as-null-pointer-constant]
       57 |              ? accept4 (cfd, NULL, 0, SOCK_CLOEXEC)
          |                                    ^
    mv -f .deps/af_alg.Tpo .deps/af_alg.Po
    [...]

Collin

>From ca12f1a835c857da458193b4a7f20c3e93bc6a1a Mon Sep 17 00:00:00 2001
Message-ID: <ca12f1a835c857da458193b4a7f20c3e93bc6a1a.1777763552.git.collin.fu...@gmail.com>
From: Collin Funk <[email protected]>
Date: Sat, 2 May 2026 15:55:32 -0700
Subject: [PATCH] crypto/af_alg: Silence -Wzero-as-null-pointer-constant
 warning.

* lib/af_alg.c (alg_socket): Use NULL instead of zero.
---
 ChangeLog    | 5 +++++
 lib/af_alg.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 5dab1a9731..9d96f6d090 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2026-05-02  Collin Funk  <[email protected]>
+
+	crypto/af_alg: Silence -Wzero-as-null-pointer-constant warning.
+	* lib/af_alg.c (alg_socket): Use NULL instead of zero.
+
 2026-05-02  Bruno Haible  <[email protected]>
 
 	strtof, strtod, strtold: Return NaNs with correct sign.
diff --git a/lib/af_alg.c b/lib/af_alg.c
index ff21f0f00a..7a04e56e39 100644
--- a/lib/af_alg.c
+++ b/lib/af_alg.c
@@ -54,7 +54,7 @@ alg_socket (char const *alg)
   if (cfd < 0)
     return -EAFNOSUPPORT;
   int ofd = (bind (cfd, (struct sockaddr *) &salg, sizeof salg) == 0
-             ? accept4 (cfd, NULL, 0, SOCK_CLOEXEC)
+             ? accept4 (cfd, NULL, NULL, SOCK_CLOEXEC)
              : -1);
   close (cfd);
   return ofd < 0 ? -EAFNOSUPPORT : ofd;
-- 
2.54.0

Reply via email to