[libfortran,committed] Fix PR31299, GETLOG intrinsic
Jakub Jelinek
jakub@redhat.com
Tue Apr 24 21:24:00 GMT 2007
On Tue, Apr 24, 2007 at 10:40:11PM +0200, FX Coudert wrote:
> The patch below fixes PR31299 by making the library function for
> GETLOG use getpwuid() and geteuid() instead of getlogin() to
> determine the current user name. Using getlogin() is not successful
> when the proccess is not attached to a terminal. This patch brings us
> in line with the behaviour of the other compilers I tested.
>
> It was bootstrapped twice already and comes with a documentation
> update to reflect the change. It's fairly simple, so I'll commit to
> trunk as soon as my i686-linux bootstrap of the latest version of the
> patch is finished.
# define GETLOG (getpwuid(geteuid())->pw_name)
This will segfault if getpwuid returns NULL.
# define GETLOG ({ struct passwd *pw = getpwuid (geteuid ()); pw != NULL ? pw->pw_name : (char *) 0; })
would be IMHO much better.
Jakub
More information about the Gcc-patches
mailing list