---
 libvtv/configure.ac | 3 +++
 libvtv/vtv_utils.cc | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/libvtv/configure.ac b/libvtv/configure.ac
index ba3009ee3fb..878ba02a2e2 100644
--- a/libvtv/configure.ac
+++ b/libvtv/configure.ac
@@ -115,6 +115,9 @@ AC_CHECK_FUNCS([__secure_getenv])
 AC_GNU_SOURCE
 AC_CHECK_FUNCS([secure_getenv])
 
+AC_GNU_SOURCE
+AC_CHECK_FUNCS([issetugid])
+
 AC_CHECK_FUNCS([getexecname __fortify_fail])
 
 # Check for programs.
diff --git a/libvtv/vtv_utils.cc b/libvtv/vtv_utils.cc
index 1e41ced4473..10efee987d4 100644
--- a/libvtv/vtv_utils.cc
+++ b/libvtv/vtv_utils.cc
@@ -46,6 +46,8 @@
 #ifndef HAVE_SECURE_GETENV
 #  ifdef HAVE___SECURE_GETENV
 #    define secure_getenv __secure_getenv
+#  elif defined HAVE_ISSETUGID
+#    define secure_getenv(name) (issetugid() ? NULL : getenv(name))
 #  else
 #    define secure_getenv getenv
 #  endif
-- 
2.16.1


Reply via email to