bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* secure_getenv: Fix warning on Android
@ 2023-01-10 13:27 Bruno Haible
  0 siblings, 0 replies; only message in thread
From: Bruno Haible @ 2023-01-10 13:27 UTC (permalink / raw)
  To: bug-gnulib

Building a testdir on Android, I see this warning:

../../gllib/secure_getenv.c:34:7: warning: call to undeclared function 'issetugid'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

The reason is that the function issetugid is not declared; therefore we should
not use it.

This patch fixes it.

2023-01-10  Bruno Haible  <bruno@clisp.org>

	secure_getenv: Fix warning on Android.
	* m4/secure_getenv.m4 (gl_FUNC_SECURE_GETENV): Test for issetugid using
	* lib/secure_getenv.c: Fix comment regarding issetugid.

diff --git a/lib/secure_getenv.c b/lib/secure_getenv.c
index 8b2dd5ec17..a0bc0cf817 100644
--- a/lib/secure_getenv.c
+++ b/lib/secure_getenv.c
@@ -30,7 +30,7 @@ secure_getenv (char const *name)
 #if HAVE___SECURE_GETENV /* glibc */
   return __secure_getenv (name);
-#elif HAVE_ISSETUGID /* OS X, FreeBSD, NetBSD, OpenBSD */
+#elif HAVE_ISSETUGID /* musl, OS X, FreeBSD, NetBSD, OpenBSD, Solaris, Minix */
   if (issetugid ())
     return NULL;
   return getenv (name);
diff --git a/m4/secure_getenv.m4 b/m4/secure_getenv.m4
index 85104e3488..acb06507cc 100644
--- a/m4/secure_getenv.m4
+++ b/m4/secure_getenv.m4
@@ -1,4 +1,4 @@
-# Look up an environment variable more securely.
+# secure_getenv.m4 serial 2
 dnl Copyright 2013-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -20,7 +20,7 @@ AC_DEFUN([gl_FUNC_SECURE_GETENV],
   if test $ac_cv_func___secure_getenv = no; then
-    AC_CHECK_FUNCS([issetugid])
+    gl_CHECK_FUNCS_ANDROID([issetugid], [[#include <unistd.h>]])
   AC_CHECK_FUNCS_ONCE([getuid geteuid getgid getegid])

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-10 14:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-10 13:27 secure_getenv: Fix warning on Android Bruno Haible

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).