On 2026-01-16 04:10, Pádraig Brady wrote:
I see there is another issue triggered by the coreutils change:
https://github.com/coreutils/coreutils/issues/173
I.e., the conflict between `typedef int context_t`
in the gnulib selinux shim, and the new assignment to NULL.
Thanks for reporting that. Fixed by installing the attached to Gnulib
(afterwards, I corrected the spelling of "whether" in ChangeLog).From 0d733c1cbcaa72e2e28699087a09aa5bdea8d246 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Fri, 16 Jan 2026 11:17:26 -0800
Subject: [PATCH] selinux-h: pacify -Wzero-as-null-pointer-constant
* lib/se-context.in.h (context_t): Make it a pointer to an
incomplete type rather than an int, so that callers can initialize
it with NULL regardless of whehter --with-selinux is used.
* lib/se-context.in.h (context_new):
* lib/se-label.in.h (selabel_open): Use the equivalent of
NULL (not NULL, since that would require including <stddef.h>).
---
ChangeLog | 10 ++++++++++
lib/se-context.in.h | 4 ++--
lib/se-label.in.h | 2 +-
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index db4ae7ff31..bd77658a74 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2026-01-16 Paul Eggert <[email protected]>
+
+ selinux-h: pacify -Wzero-as-null-pointer-constant
+ * lib/se-context.in.h (context_t): Make it a pointer to an
+ incomplete type rather than an int, so that callers can initialize
+ it with NULL regardless of whehter --with-selinux is used.
+ * lib/se-context.in.h (context_new):
+ * lib/se-label.in.h (selabel_open): Use the equivalent of
+ NULL (not NULL, since that would require including <stddef.h>).
+
2026-01-15 Paul Eggert <[email protected]>
manywarnings: -Wzero-as-null-pointer-constant in C
diff --git a/lib/se-context.in.h b/lib/se-context.in.h
index ecc42032c9..37cc7a6dff 100644
--- a/lib/se-context.in.h
+++ b/lib/se-context.in.h
@@ -42,10 +42,10 @@ _GL_INLINE_HEADER_BEGIN
#endif
-typedef int context_t;
+typedef struct context_t *context_t;
SE_CONTEXT_INLINE context_t
context_new (char const *_GL_UNNAMED (s))
- { errno = ENOTSUP; return 0; }
+ { errno = ENOTSUP; return (void *) 0; }
SE_CONTEXT_INLINE char *
context_str (context_t _GL_UNNAMED (con))
{ errno = ENOTSUP; return (void *) 0; }
diff --git a/lib/se-label.in.h b/lib/se-label.in.h
index 19b5f26aa6..159adb6693 100644
--- a/lib/se-label.in.h
+++ b/lib/se-label.in.h
@@ -64,7 +64,7 @@ SE_LABEL_INLINE struct selabel_handle *
selabel_open (int _GL_UNNAMED (backend),
struct selinux_opt *_GL_UNNAMED (options),
unsigned _GL_UNNAMED (nopt))
-{ errno = ENOTSUP; return 0; }
+{ errno = ENOTSUP; return (void *) 0; }
SE_LABEL_INLINE void
selabel_close (struct selabel_handle *_GL_UNNAMED (hnd))
--
2.51.0