$NetBSD: patch-ac,v 1.2 2005/07/10 19:57:07 christos Exp $ --- src/log.c.orig 2004-08-07 18:22:42.000000000 -0400 +++ src/log.c 2005-07-10 15:50:13.000000000 -0400 @@ -59,7 +59,8 @@ int res = 0; static int fd = -1; -#if (defined(SVR4) || defined(__SVR4)) && \ +#if ((defined(SVR4) || defined(__SVR4)) || \ + (defined(__NetBSD__) && defined(HAVE_UTMPX_H))) && \ !(defined(LINUX) || defined(__hpux) || defined (_AIX)) /* This "auxilliary" utmp doesn't exist under linux. */ #ifdef __sparcv9 @@ -70,6 +71,10 @@ #endif static int fdx = -1; +#if !defined(WTMPX_FILE) && defined(_PATH_WTMPX) +# define WTMPX_FILE _PATH_WTMPX +#endif + if (fdx < 0 && (fdx = open(WTMPX_FILE, O_WRONLY|O_APPEND, 0)) < 0) { pr_log_pri(PR_LOG_WARNING, "wtmpx %s: %s", WTMPX_FILE, strerror(errno)); @@ -89,14 +94,20 @@ sstrncpy(utx.ut_id, "ftp", sizeof(utx.ut_user)); sstrncpy(utx.ut_line, line, sizeof(utx.ut_line)); sstrncpy(utx.ut_host, host, sizeof(utx.ut_host)); - utx.ut_syslen = strlen(utx.ut_host)+1; utx.ut_pid = getpid(); -#ifdef __sparcv9 +#if defined(__NetBSD__) && defined(HAVE_UTMPX_H) + memcpy(&utx.ut_ss, &ip->na_addr, sizeof(ip->na_addr)); + gettimeofday(&utx.ut_tv, NULL); +#else /* SVR4 */ + utx.ut_syslen = strlen(utx.ut_host)+1; +# ifdef __sparcv9 time(&t); utx.ut_tv.tv_sec = (time32_t)t; -#else +# else time(&utx.ut_tv.tv_sec); -#endif +# endif +#endif /* SVR4 */ + if (*name) utx.ut_type = USER_PROCESS; else