From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26585 invoked by alias); 22 Mar 2007 09:36:23 -0000 Received: (qmail 26551 invoked by uid 48); 22 Mar 2007 09:36:13 -0000 Date: Thu, 22 Mar 2007 09:36:00 -0000 Message-ID: <20070322093613.26550.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/31299] Use getpwuid(geteuid()) instead of getlogin() for GETLOG() In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "burnus at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-03/txt/msg02110.txt.bz2 ------- Comment #9 from burnus at gcc dot gnu dot org 2007-03-22 09:36 ------- Bob Proulx wrote at bugs-coreutils@ > Regardless of that I think it would be better if the program calling > getlogin() avoided using it since using the utmp file for this > accounting is often a source of troublesome errors. The login user is > rarely the right answer. Usually the current effective id provided by > getpwuid(geteuid()) would be better. I expect that use of getlogin() > in the original case that motivated this example is actually a bug by > itself. Thus: We should consider using getpwuid(geteuid()) which is also what g95 does, maybe guarded by "#ifdef" (or maybe not, both are part of IEEE 1003.1-2001/POSIX): #include struct passwd *getpwuid(uid_t uid); and #include uid_t geteuid(void); (I somehow missed initially the clause "getlogin() function shall return a pointer to a string containing the user name associated by the login activity with the *controlling terminal* of the current process.") One should probably also update the manual together with this change?!? -- burnus at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement Status|RESOLVED |UNCONFIRMED Resolution|WONTFIX | Summary|getlog returns blanks when |Use getpwuid(geteuid()) |not run from the command |instead of getlogin() for |prompt |GETLOG() http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31299