stdalign, verify: port to FreeBSD 9.1, to C11, and to C++11
[gnulib.git] / lib / secure_getenv.c
index 0b91a99..1fb61bb 100644 (file)
    You should have received a copy of the GNU Lesser General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include <config.h>
+
 #include <stdlib.h>
 
+#if !HAVE___SECURE_GETENV
+# if HAVE_ISSETUGID
+#  include <unistd.h>
+# else
+#  undef issetugid
+#  define issetugid() 1
+# endif
+#endif
+
 char *
 secure_getenv (char const *name)
 {
 #if HAVE___SECURE_GETENV
   return __secure_getenv (name);
 #else
-  return 0;
+  if (issetugid ())
+    return 0;
+  return getenv (name);
 #endif
 }