Problem with getuid() -- same as geteuid()?!
Steven Winikoff
smw at maxwell.concordia.ca
Sat Feb 3 07:54:34 AEST 1990
I've encountered a problem using getuid(), on both a Sun 4/280 under
SunOS 4.0 and a MIPS M-120/5 under MIPS RISC/os 4.0.1 (SVR3 plus BSD
compatibility). The following short program produces the same results
on both systems, and replicates the behaviour I've experienced in the
middle of a much larger application:
#include <stdio.h>
main()
{
int getuid();
printf("uid = %d\n", getuid());
}
When I log in as user "smw" (user index = 1000), the program does indeed
return "uid = 1000".
However, when I then execute the su command, I receive "uid = 0" instead
of the expected "uid = 1000".
Am I missing something? I thought that this was the expected behaviour
for geteuid() instead of getuid(), and that's why I used getuid() in the
first place!
Can anyone tell me if I'm just confused, or if I'm simply not doing it
right, or if there's actually a bug in the Sun and MIPS implementation
of these calls?
Thanks very much in advance!
Regards,
- Steven
------------------------------------------------------------------------
Steven Winikoff smw at maxwell.concordia.ca
Software Analyst
Dept. of Computing services
Concordia University voice: (514) 848-7619
Montreal, Quebec, Canada (10:00-18:00 EST)
More information about the Comp.unix.questions
mailing list