diff --git a/configure.ac b/configure.ac index 1949ef62..c44e1f0e 100644 --- a/configure.ac +++ b/configure.ac @@ -173,7 +173,7 @@ AC_CHECK_LIB(X11, XOpenDisplay, [GTK_LIBS="-lX11 $GTK_LIBS" AC_DEFINE([HAVE_LIBX11],[],[Define if libX11.a is available])]) -AC_CHECK_FUNCS([getaddrinfo posix_openpt ptsname setresuid strsignal updwtmpx fstatat dirfd futimes]) +AC_CHECK_FUNCS([getaddrinfo posix_openpt ptsname setresuid strsignal updwtmpx fstatat dirfd futimes setpwent endpwent]) AC_CHECK_DECLS([CLOCK_MONOTONIC], [], [], [[#include ]]) AC_CHECK_HEADERS([sys/auxv.h asm/hwcap.h]) AC_SEARCH_LIBS([clock_gettime], [rt], [AC_DEFINE([HAVE_CLOCK_GETTIME],[],[Define if clock_gettime() is available])]) diff --git a/unix/uxmisc.c b/unix/uxmisc.c index 2170c3c4..00c19779 100644 --- a/unix/uxmisc.c +++ b/unix/uxmisc.c @@ -119,7 +119,9 @@ char *get_username(void) * coping correctly with people who have su'ed. */ user = getlogin(); +#if HAVE_SETPWENT setpwent(); +#endif if (user) p = getpwnam(user); else @@ -141,7 +143,9 @@ char *get_username(void) return NULL; ret = p->pw_name; } +#if HAVE_ENDPWENT endpwent(); +#endif return dupstr(ret); }