Skip to contentSkip to conversation

policycoreutils: run_init: define _GNU_SOURCE

PATCH In review Robert Marko 2 participants 3 messages May 1, 2025 – May 6, 2025 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 policycoreutils: run_init: define _GNU_SOURCE

Trying to compile run_init with musl will fail with:
run_init.c: In function 'authenticate_via_shadow_passwd':
run_init.c:206:40: error: implicit declaration of function 'getpass' [-Wimplicit-function-declaration]
206 | if (!(unencrypted_password_s = getpass(PASSWORD_PROMPT))) {

This is because getpass in musl is guarded only for _GNU_SOURCE, so define _GNU_SOURCE for run_init.

---
 policycoreutils/run_init/run_init.c | 2 ++
 1 file changed, 2 insertions(+)
policycoreutils/run_init/run_init.c +2 -0
index ce499781..4531a8ba 100644
@@ -37,6 +37,8 @@
  *
  *************************************************************************/
 
+#define _GNU_SOURCE
+
 #include <stdio.h>
 #include <stdlib.h>		/* for malloc(), realloc(), free() */
 #include <pwd.h>		/* for getpwuid() */
Signature · 1 line
2.49.0
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Robert Marko

Trying to compile run_init with musl will fail with:
run_init.c: In function 'authenticate_via_shadow_passwd':
run_init.c:206:40: error: implicit declaration of function 'getpass' [-Wimplicit-function-declaration]
206 | if (!(unencrypted_password_s = getpass(PASSWORD_PROMPT))) {

This is because getpass in musl is guarded only for _GNU_SOURCE, so define _GNU_SOURCE for run_init.

Quoted 21 lines
---
 policycoreutils/run_init/run_init.c | 2 ++
 1 file changed, 2 insertions(+)
policycoreutils/run_init/run_init.c +2 -1
index ce499781..4531a8ba 100644
@@ -37,6 +37,8 @@
  *
  *************************************************************************/
 
+#define _GNU_SOURCE
+
 #include <stdio.h>
 #include <stdlib.h>            /* for malloc(), realloc(), free() */
 #include <pwd.h>               /* for getpwuid() */
--

2.49.0

#2 lore raw
Quoted 8 lines · James Carter
Quoted 6 lines · Robert Marko

Trying to compile run_init with musl will fail with:
run_init.c: In function 'authenticate_via_shadow_passwd':
run_init.c:206:40: error: implicit declaration of function 'getpass' [-Wimplicit-function-declaration]
206 | if (!(unencrypted_password_s = getpass(PASSWORD_PROMPT))) {

Quoted 7 lines
Quoted 4 lines

This is because getpass in musl is guarded only for _GNU_SOURCE, so define _GNU_SOURCE for run_init.

Merged.
Thanks,
Jim

Quoted 21 lines
Quoted 21 lines
---
 policycoreutils/run_init/run_init.c | 2 ++
 1 file changed, 2 insertions(+)
policycoreutils/run_init/run_init.c +2 -1
index ce499781..4531a8ba 100644
@@ -37,6 +37,8 @@
  *
  *************************************************************************/
 
+#define _GNU_SOURCE
+
 #include <stdio.h>
 #include <stdlib.h>            /* for malloc(), realloc(), free() */
 #include <pwd.h>               /* for getpwuid() */
--

2.49.0