diff --git a/client/hostinfo_unix.C b/client/hostinfo_unix.C index ad7ccf2e49..b510808ac0 100644 --- a/client/hostinfo_unix.C +++ b/client/hostinfo_unix.C @@ -445,7 +445,15 @@ static struct utmp ut; struct utmp *getutent() { if (ufp == NULL) { +#if defined(HAVE__ETC_UTMP) + if ((ufp = fopen("/etc/utmp", "r")) == NULL) { +#elif defined(HAVE__VAR_RUN_UTMP) + if ((ufp = fopen("/var/run/utmp", "r")) == NULL) { +#elif defined(HAVE__RUN_ADM_UTMP) + if ((ufp = fopen("/var/adm/utmp", "r")) == NULL) { +#else if ((ufp = fopen(UTMP_FILE, "r")) == NULL) { +#endif return((struct utmp *)NULL); } } diff --git a/config.h.in b/config.h.in index a6f1d0dc6a..c5d7b58580 100644 --- a/config.h.in +++ b/config.h.in @@ -296,6 +296,15 @@ /* Define to 1 if /dev/tty1 exists */ #undef HAVE__DEV_TTY1 +/* Define to 1 if you have the file `/etc/utmp'. */ +#undef HAVE__ETC_UTMP + +/* Define to 1 if you have the file `/var/adm/utmp'. */ +#undef HAVE__VAR_ADM_UTMP + +/* Define to 1 if you have the file `/var/run/utmp'. */ +#undef HAVE__VAR_RUN_UTMP + /* Host for this compilation */ #undef HOSTTYPE diff --git a/configure b/configure index 04f47f735a..84d7a552dd 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac Revision: 1.94 . +# From configure.ac Revision: 1.95 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.57 for BOINC 3.11. # @@ -7774,6 +7774,83 @@ _ACEOF fi +echo "$as_me:$LINENO: checking for /var/run/utmp" >&5 +echo $ECHO_N "checking for /var/run/utmp... $ECHO_C" >&6 +if test "${ac_cv_file__var_run_utmp+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + test "$cross_compiling" = yes && + { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 +echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} + { (exit 1); exit 1; }; } +if test -r "/var/run/utmp"; then + ac_cv_file__var_run_utmp=yes +else + ac_cv_file__var_run_utmp=no +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_file__var_run_utmp" >&5 +echo "${ECHO_T}$ac_cv_file__var_run_utmp" >&6 +if test $ac_cv_file__var_run_utmp = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE__VAR_RUN_UTMP 1 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking for /var/adm/utmp" >&5 +echo $ECHO_N "checking for /var/adm/utmp... $ECHO_C" >&6 +if test "${ac_cv_file__var_adm_utmp+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + test "$cross_compiling" = yes && + { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 +echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} + { (exit 1); exit 1; }; } +if test -r "/var/adm/utmp"; then + ac_cv_file__var_adm_utmp=yes +else + ac_cv_file__var_adm_utmp=no +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_file__var_adm_utmp" >&5 +echo "${ECHO_T}$ac_cv_file__var_adm_utmp" >&6 +if test $ac_cv_file__var_adm_utmp = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE__VAR_ADM_UTMP 1 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking for /etc/utmp" >&5 +echo $ECHO_N "checking for /etc/utmp... $ECHO_C" >&6 +if test "${ac_cv_file__etc_utmp+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + test "$cross_compiling" = yes && + { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 +echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} + { (exit 1); exit 1; }; } +if test -r "/etc/utmp"; then + ac_cv_file__etc_utmp=yes +else + ac_cv_file__etc_utmp=no +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_file__etc_utmp" >&5 +echo "${ECHO_T}$ac_cv_file__etc_utmp" >&6 +if test $ac_cv_file__etc_utmp = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE__ETC_UTMP 1 +_ACEOF + + +fi + + if test -e "/dev/mouse"; then cat >>confdefs.h <<\_ACEOF diff --git a/configure.ac b/configure.ac index 3111a4d876..8ac5dbaf1c 100644 --- a/configure.ac +++ b/configure.ac @@ -120,6 +120,8 @@ AC_TYPE_SIZE_T AC_STRUCT_TM AC_STRUCT_TIMEZONE +AC_CHECK_FILES(/var/run/utmp /var/adm/utmp /etc/utmp) + dnl Checks for device files if test -e "/dev/mouse"; then AC_DEFINE(HAVE__DEV_MOUSE, 1, [Define to 1 if /dev/mouse exists])