]> code.citadel.org Git - citadel.git/commitdiff
fix for certain SYSV variants which lack utmp.ut_host
authorNathan Bryant <loanshark@uncensored.citadel.org>
Thu, 13 May 1999 04:27:25 +0000 (04:27 +0000)
committerNathan Bryant <loanshark@uncensored.citadel.org>
Thu, 13 May 1999 04:27:25 +0000 (04:27 +0000)
citadel/acconfig.h
citadel/configure.in
citadel/routines.c

index 47245d8dbd75f1929ee510781ac7a001f8575d42..6b52e2f41a4c504350871c5168375e48c8039eec 100644 (file)
@@ -10,6 +10,9 @@
 /* define this if struct utmp has an ut_type member */
 #undef HAVE_UT_TYPE
 
+/* define this if struct utmp has an ut_host member */
+#undef HAVE_UT_HOST
+
 /* define this if the OS has broken non-reentrant gethostby{name,addr}() */
 #undef HAVE_NONREENTRANT_NETDB
 
index 0d12ea3e15453401f62de908e6e3c2bf3e3f9498..d0f869e563fa151626ec59e5126ccbda25f37a96 100644 (file)
@@ -174,6 +174,13 @@ if test $ac_cv_struct_ut_type = yes; then
        AC_DEFINE(HAVE_UT_TYPE)
 fi
 
+AC_CACHE_CHECK([for ut_host in struct utmp], ac_cv_struct_ut_host,
+[AC_TRY_COMPILE([#include <utmp.h>], [struct utmp ut; ut.ut_host;],
+ac_cv_struct_ut_host=yes, ac_cv_struct_ut_host=no)])
+if test $ac_cv_struct_ut_host = yes; then
+       AC_DEFINE(HAVE_UT_HOST)
+fi
+
 dnl Checks for library functions.
 AC_FUNC_GETPGRP
 AC_PROG_GCC_TRADITIONAL
index 5bee93e9c557d2bfab32e3a837c0ac1d2d92da42..2b0920d681d2dacab39bfb359ac1bf2fcc8525d8 100644 (file)
@@ -454,9 +454,11 @@ void locate_host(char *hbuf)
 #ifdef HAVE_UT_TYPE
        if (put->ut_type == USER_PROCESS) {
 #endif
+#ifdef HAVE_UT_HOST
                if (*put->ut_host)
                        safestrncpy(hbuf, put->ut_host, 24);
                else
+#endif
                        safestrncpy(hbuf, put->ut_line, 24);
 #ifdef HAVE_UT_TYPE
                }