This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, libfortran] Fix handling of temporary files
On Thu, Apr 19, 2012 at 14:43, Janne Blomqvist
<blomqvist.janne@gmail.com> wrote:
> Also, I suspect getuid and friends are not actually part of the NSS
> stuff. The uid/gid/euid/egid are maintained for each process by the
> kernel, and NSS only handles translation to/from the numeric id's to
> string values, IP address lookup and so forth.
.. as can be seen with the example below:
#include <unistd.h>
#include <sys/types.h>
#include <pwd.h>
#include <stdio.h>
int main(void)
{
uid_t uid = getuid();
//struct passwd *pwd = getpwuid(uid);
//printf("%s ", pwd->pw_name);
printf("%d %d %d %d\n", uid, geteuid(), getgid(), getegid());
return 0;
}
$ gcc getuid.c -static
$ strace ./a.out
(No need to open further files)
Uncommenting the two commented lines:
$ gcc getuid.c -static
/tmp/cc6B1i8n.o: In function `main':
getuid.c:(.text+0x16): warning: Using 'getpwuid' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
$ strace ./a.out
(Evidence of communicating with nscd per the NSS configuration on this system)
Hence get{uid,euid,gid,egid} should not have any problems with static linking.
--
Janne Blomqvist