summaryrefslogtreecommitdiff
path: root/sysdeps/generic/enbl-secure.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-05-06 06:34:21 +0000
committerUlrich Drepper <drepper@redhat.com>2003-05-06 06:34:21 +0000
commitbe4d80380a87ab758aecb4e25695b264d36156da (patch)
tree1eff92d850952d6f9ff8e6e9a1aea83022783092 /sysdeps/generic/enbl-secure.c
parent9946f75ad4b3183a09c3f3ff1c3554613fb4f485 (diff)
Update.
* sysdeps/generic/enbl-secure.c (__libc_enable_secure_decided): New variable. (__libc_init_secure): Don't do anything if __libc_enable_secure_decided is nonzero. * include/unistd.h: Declare __libc_enable_secure_decided. * elf/dl-support.c (_dl_aux_init): Recognize AT_UID, AT_EUID, AT_GID, and AT_EGID. If all found, set __libc_enable_secure and __libc_enable_secure_decided.
Diffstat (limited to 'sysdeps/generic/enbl-secure.c')
-rw-r--r--sysdeps/generic/enbl-secure.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sysdeps/generic/enbl-secure.c b/sysdeps/generic/enbl-secure.c
index c811712087..fac3b9c527 100644
--- a/sysdeps/generic/enbl-secure.c
+++ b/sysdeps/generic/enbl-secure.c
@@ -1,5 +1,5 @@
/* Define and initialize the `__libc_enable_secure' flag. Generic version.
- Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -23,12 +23,15 @@
#include <unistd.h>
#include <libc-internal.h>
+/* If nonzero __libc_enable_secure is already set. */
+int __libc_enable_secure_decided;
/* Safest assumption, if somehow the initializer isn't run. */
int __libc_enable_secure = 1;
void
__libc_init_secure (void)
{
- __libc_enable_secure = (__geteuid () != __getuid ()
- || __getegid () != __getgid ());
+ if (__libc_enable_secure_decided == 0)
+ __libc_enable_secure = (__geteuid () != __getuid ()
+ || __getegid () != __getgid ());
}