From: Eric Backus Subject: getuid vs. stat To: djgpp AT sun DOT soe DOT clarkson DOT edu (djgpp) Date: Tue, 7 Jul 92 9:18:53 PDT Mailer: Elm [revision: 66.25] I notice that getuid() and getgid() return something like 42 (or was it 47?). Since there aren't really different users (or groups) on a PC, it would seem that the value returned doesn't matter. However, if you stat() a file, it says that the file uid and gid are zero. Thus, a program that calls getuid() and stat() to see if it owns a file will decide that it doesn't own the file and isn't allowed to modify it. This is of course not true. It seems to me that stat() and getuid() should be consistant about user ids. Either both should use zero (so that all files are owned by root, and all programs think they are run by root), or they should both return the same non-zero value. The second way is probably slightly better but might be slightly harder to do. The same argument applies to group ids. I ran into this when trying to compile the FSF fileutils. One example of the effects of the current setup is that the rm program doesn't think it has write permission on any file, so it will prompt before removing any file. -- Eric Backus ericb%hplsla AT hplabs DOT hp DOT com (206) 335-2495