aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2013-06-16 14:34:59 -0400
committerTheodore Ts'o <tytso@mit.edu>2013-06-16 14:34:59 -0400
commit1ad3174af5213fa7029944cc19723cda08f221d3 (patch)
treef976fa448d0841d5b79da49f6260f974a1a37924
parentdc9cc7006a61d0ef82ee4e1dee133998c6040765 (diff)
downloadandroid_external_e2fsprogs-1ad3174af5213fa7029944cc19723cda08f221d3.tar.gz
android_external_e2fsprogs-1ad3174af5213fa7029944cc19723cda08f221d3.tar.bz2
android_external_e2fsprogs-1ad3174af5213fa7029944cc19723cda08f221d3.zip
Try to use secure_getenv() in preference to __secure_getenv()
If secure_getenv() use it in preference to __secure_getenv(). Starting with (e)glibc version 2.17, secure_getenv() exists, while __secure_getenv() only works with shared library links (where it is a weak symbol), but not for static links with /lib/libc.a Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rwxr-xr-xconfigure2
-rw-r--r--configure.in1
-rw-r--r--lib/blkid/cache.c7
-rw-r--r--lib/config.h.in3
-rw-r--r--lib/et/error_message.c7
-rw-r--r--lib/ext2fs/test_io.c10
-rw-r--r--lib/ss/pager.c7
7 files changed, 32 insertions, 5 deletions
diff --git a/configure b/configure
index c91e6059..fdbb3e98 100755
--- a/configure
+++ b/configure
@@ -11010,7 +11010,7 @@ if test "$ac_res" != no; then :
fi
fi
-for ac_func in __secure_getenv backtrace blkid_probe_get_topology chflags fallocate fallocate64 fchown fdatasync fstat64 ftruncate64 getdtablesize getmntinfo getpwuid_r getrlimit getrusage jrand48 llseek lseek64 mallinfo mbstowcs memalign mmap msync nanosleep open64 pathconf posix_fadvise posix_memalign prctl setmntent setresgid setresuid srandom strcasecmp strdup strnlen strptime strtoull sync_file_range sysconf usleep utime valloc
+for ac_func in __secure_getenv backtrace blkid_probe_get_topology chflags fallocate fallocate64 fchown fdatasync fstat64 ftruncate64 getdtablesize getmntinfo getpwuid_r getrlimit getrusage jrand48 llseek lseek64 mallinfo mbstowcs memalign mmap msync nanosleep open64 pathconf posix_fadvise posix_memalign prctl secure_getenv setmntent setresgid setresuid srandom strcasecmp strdup strnlen strptime strtoull sync_file_range sysconf usleep utime valloc
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
diff --git a/configure.in b/configure.in
index c3687bb8..5ca968f3 100644
--- a/configure.in
+++ b/configure.in
@@ -1025,6 +1025,7 @@ AC_CHECK_FUNCS(m4_flatten([
posix_fadvise
posix_memalign
prctl
+ secure_getenv
setmntent
setresgid
setresuid
diff --git a/lib/blkid/cache.c b/lib/blkid/cache.c
index 73900a51..8bdd2399 100644
--- a/lib/blkid/cache.c
+++ b/lib/blkid/cache.c
@@ -11,6 +11,9 @@
*/
#include "config.h"
+#if HAVE_SECURE_GETENV
+#define _GNU_SOURCE
+#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -49,7 +52,9 @@ static char *safe_getenv(const char *arg)
#endif
#endif
-#ifdef HAVE___SECURE_GETENV
+#if defined(HAVE_SECURE_GETENV)
+ return secure_getenv(arg);
+#elif defined(HAVE___SECURE_GETENV)
return __secure_getenv(arg);
#else
return getenv(arg);
diff --git a/lib/config.h.in b/lib/config.h.in
index e14eff4f..0c7d8544 100644
--- a/lib/config.h.in
+++ b/lib/config.h.in
@@ -296,6 +296,9 @@
/* Define to 1 if if struct sockaddr contains sa_len */
#undef HAVE_SA_LEN
+/* Define to 1 if you have the `secure_getenv' function. */
+#undef HAVE_SECURE_GETENV
+
/* Define to 1 if you have the <semaphore.h> header file. */
#undef HAVE_SEMAPHORE_H
diff --git a/lib/et/error_message.c b/lib/et/error_message.c
index dc77b69f..92509e63 100644
--- a/lib/et/error_message.c
+++ b/lib/et/error_message.c
@@ -17,6 +17,9 @@
*/
#include "config.h"
+#if HAVE_SECURE_GETENV
+#define _GNU_SOURCE
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -209,7 +212,9 @@ static char *safe_getenv(const char *arg)
#endif
#endif
-#ifdef HAVE___SECURE_GETENV
+#if defined(HAVE_SECURE_GETENV)
+ return secure_getenv(arg);
+#elif defined(HAVE___SECURE_GETENV)
return __secure_getenv(arg);
#else
return getenv(arg);
diff --git a/lib/ext2fs/test_io.c b/lib/ext2fs/test_io.c
index 7d3cdfed..cac67219 100644
--- a/lib/ext2fs/test_io.c
+++ b/lib/ext2fs/test_io.c
@@ -10,6 +10,12 @@
*/
#include "config.h"
+#if HAVE_SECURE_GETENV
+#define _GNU_SOURCE
+#endif
+#if HAVE_SECURE_GETENV
+#define _GNU_SOURCE
+#endif
#include <stdio.h>
#include <string.h>
#if HAVE_UNISTD_H
@@ -173,7 +179,9 @@ static char *safe_getenv(const char *arg)
#endif
#endif
-#ifdef HAVE___SECURE_GETENV
+#if defined(HAVE_SECURE_GETENV)
+ return secure_getenv(arg);
+#elif defined(HAVE___SECURE_GETENV)
return __secure_getenv(arg);
#else
return getenv(arg);
diff --git a/lib/ss/pager.c b/lib/ss/pager.c
index 2b3a4665..8b54dd1a 100644
--- a/lib/ss/pager.c
+++ b/lib/ss/pager.c
@@ -15,6 +15,9 @@
*/
#include "config.h"
+#if HAVE_SECURE_GETENV
+#define _GNU_SOURCE
+#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -56,7 +59,9 @@ char *ss_safe_getenv(const char *arg)
#endif
#endif
-#ifdef HAVE___SECURE_GETENV
+#if defined(HAVE_SECURE_GETENV)
+ return secure_getenv(arg);
+#elif defined(HAVE___SECURE_GETENV)
return __secure_getenv(arg);
#else
return getenv(arg);