re PR libfortran/31299 (Use getpwuid(geteuid()) instead of getlogin() for GETLOG())

PR libfortran/31299
	* intrinsics/getlog.c: Use getpwuid and geteuid instead of
	getlogin if they are available.
	* configure.ac: Add checks for getpwuid and geteuid.
	* configure: Regenerate.
	* config.h.in: Regenerate.

From-SVN: r124143
This commit is contained in:
François-Xavier Coudert 2007-04-25 07:36:20 +00:00
parent 78511f8b0d
commit 6422c11230
5 changed files with 649 additions and 278 deletions

View File

@ -1,3 +1,12 @@
2007-04-25 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR libfortran/31299
* intrinsics/getlog.c: Use getpwuid and geteuid instead of
getlogin if they are available.
* configure.ac: Add checks for getpwuid and geteuid.
* configure: Regenerate.
* config.h.in: Regenerate.
2007-04-25 Janne Blomqvist <jb@gcc.gnu.org>
* configure: Regenerate using autoconf 2.59.
@ -6,7 +15,7 @@
2007-04-24 Janne Blomqvist <jb@gcc.gnu.org>
PR fortran/27740
PR libfortran/27740
* configure.ac: New test to determine if symbol versioning is
supported.
* Makefile.am: Use result of above test to add appropriate linker

View File

@ -381,6 +381,9 @@
/* Define to 1 if you have the `ftruncate' function. */
#undef HAVE_FTRUNCATE
/* libc includes geteuid */
#undef HAVE_GETEUID
/* libc includes getgid */
#undef HAVE_GETGID
@ -396,6 +399,9 @@
/* libc includes getppid */
#undef HAVE_GETPPID
/* Define to 1 if you have the `getpwuid' function. */
#undef HAVE_GETPWUID
/* Define to 1 if you have the `getrlimit' function. */
#undef HAVE_GETRLIMIT
@ -522,6 +528,9 @@
/* libm includes powl */
#undef HAVE_POWL
/* Define to 1 if you have the <pwd.h> header file. */
#undef HAVE_PWD_H
/* libm includes round */
#undef HAVE_ROUND

875
libgfortran/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -178,7 +178,7 @@ AC_HEADER_TIME
AC_HAVE_HEADERS(stdlib.h string.h unistd.h signal.h)
AC_CHECK_HEADERS(time.h sys/time.h sys/times.h sys/resource.h)
AC_CHECK_HEADERS(sys/types.h sys/stat.h sys/wait.h floatingpoint.h ieeefp.h)
AC_CHECK_HEADERS(fenv.h fptrap.h float.h execinfo.h)
AC_CHECK_HEADERS(fenv.h fptrap.h float.h execinfo.h pwd.h)
AC_CHECK_HEADER([complex.h],[AC_DEFINE([HAVE_COMPLEX_H], [1], [complex.h exists])])
GCC_HEADER_STDINT(gstdint.h)
@ -191,7 +191,7 @@ AC_CHECK_FUNCS(getrusage times mkstemp strtof strtold snprintf ftruncate chsize)
AC_CHECK_FUNCS(chdir strerror getlogin gethostname kill link symlink perror)
AC_CHECK_FUNCS(sleep time ttyname signal alarm ctime clock access fork execl)
AC_CHECK_FUNCS(wait setmode execvp pipe dup2 close fdopen strcasestr getrlimit)
AC_CHECK_FUNCS(gettimeofday stat fstat lstat)
AC_CHECK_FUNCS(gettimeofday stat fstat lstat getpwuid)
# Check for glibc backtrace functions
AC_CHECK_FUNCS(backtrace backtrace_symbols)
@ -204,9 +204,9 @@ AC_CHECK_LIB([c],[getgid],[AC_DEFINE([HAVE_GETGID],[1],[libc includes getgid])])
AC_CHECK_LIB([c],[getpid],[AC_DEFINE([HAVE_GETPID],[1],[libc includes getpid])])
AC_CHECK_LIB([c],[getppid],[AC_DEFINE([HAVE_GETPPID],[1],[libc includes getppid])])
AC_CHECK_LIB([c],[getuid],[AC_DEFINE([HAVE_GETUID],[1],[libc includes getuid])])
AC_CHECK_LIB([c],[geteuid],[AC_DEFINE([HAVE_GETEUID],[1],[libc includes geteuid])])
# Check for C99 (and other IEEE) math functions
# ??? This list seems awful long. Is there a better way to test for these?
AC_CHECK_LIB([m],[acosf],[AC_DEFINE([HAVE_ACOSF],[1],[libm includes acosf])])
AC_CHECK_LIB([m],[acos],[AC_DEFINE([HAVE_ACOS],[1],[libm includes acos])])
AC_CHECK_LIB([m],[acosl],[AC_DEFINE([HAVE_ACOSL],[1],[libm includes acosl])])

View File

@ -37,7 +37,12 @@ Boston, MA 02110-1301, USA. */
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
/* Windows32 version */
#if defined __MINGW32__ && !defined HAVE_GETLOGIN
@ -66,7 +71,6 @@ w32_getlogin (void)
process.
CHARACTER(len=*), INTENT(OUT) :: LOGIN */
#ifdef HAVE_GETLOGIN
void PREFIX(getlog) (char *, gfc_charlen_type);
export_proto_np(PREFIX(getlog));
@ -78,7 +82,22 @@ PREFIX(getlog) (char * login, gfc_charlen_type login_len)
memset (login, ' ', login_len); /* Blank the string. */
p = getlogin ();
#if defined(HAVE_GETPWUID) && defined(HAVE_GETEUID)
{
struct passwd *pw = getpwuid (geteuid ());
if (pw)
p = pw->pw_name;
else
return;
}
#else
# ifdef HAVE_GETLOGIN
p = getlogin();
# else
return;
# endif
#endif
if (p == NULL)
return;
@ -88,4 +107,3 @@ PREFIX(getlog) (char * login, gfc_charlen_type login_len)
else
memcpy (login, p, p_len);
}
#endif