public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/31299] Use getpwuid(geteuid()) instead of getlogin() for GETLOG()
Date: Thu, 22 Mar 2007 09:36:00 -0000	[thread overview]
Message-ID: <20070322093613.26550.qmail@sourceware.org> (raw)
In-Reply-To: <bug-31299-14284@http.gcc.gnu.org/bugzilla/>



------- 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 <pwd.h>
       struct passwd *getpwuid(uid_t uid);
and
       #include <unistd.h>
       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


  parent reply	other threads:[~2007-03-22  9:36 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-21 16:31 [Bug fortran/31299] New: getlog returns blanks when not run from the command prompt michael dot a dot richmond at nasa dot gov
2007-03-21 16:50 ` [Bug fortran/31299] " pinskia at gcc dot gnu dot org
2007-03-21 17:00 ` michael dot a dot richmond at nasa dot gov
2007-03-21 17:28 ` burnus at gcc dot gnu dot org
2007-03-21 17:31 ` pinskia at gcc dot gnu dot org
2007-03-21 17:35 ` pinskia at gcc dot gnu dot org
2007-03-21 18:02 ` burnus at gcc dot gnu dot org
2007-03-22  4:46 ` ebb9 at byu dot net
2007-03-22  7:42 ` burnus at gcc dot gnu dot org
2007-03-22  9:36 ` burnus at gcc dot gnu dot org [this message]
2007-03-22 13:54 ` [Bug fortran/31299] I can produce the bug without using nohup michael dot a dot richmond at nasa dot gov
2007-03-22 15:20 ` pinskia at gcc dot gnu dot org
2007-03-23 21:29 ` [Bug libfortran/31299] Use getpwuid(geteuid()) instead of getlogin() for GETLOG() fxcoudert at gcc dot gnu dot org
2007-03-26  9:33 ` fxcoudert at gcc dot gnu dot org
2007-04-18 16:26 ` dfranke at gcc dot gnu dot org
2007-04-18 16:57 ` fxcoudert at gcc dot gnu dot org
2007-04-18 18:16 ` dfranke at gcc dot gnu dot org
2007-04-18 18:21 ` fxcoudert at gcc dot gnu dot org
2007-04-18 18:39 ` dfranke at gcc dot gnu dot org
2007-04-25  7:36 ` fxcoudert at gcc dot gnu dot org
2007-04-25  7:37 ` fxcoudert at gcc dot gnu dot org
2007-04-25  7:39 ` fxcoudert at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070322093613.26550.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).