AC_DEFINE(HAVE_SYSLOG_H)
diff -ur proftpd-1.3.1rc2/src/log.c proftpd-1.3.1rc2.wtmpx/src/log.c
--- proftpd-1.3.1rc2/src/log.c 2006-12-11 20:53:43.000000000 +0100
-+++ proftpd-1.3.1rc2.wtmpx/src/log.c 2007-08-20 14:46:55.000000000 +0200
++++ proftpd-1.3.1rc2.wtmpx/src/log.c 2007-08-20 14:52:13.000000000 +0200
@@ -59,119 +59,124 @@
int res = 0;
static int fd = -1;
-#else
- struct utmpx utx;
-#endif
-- static int fdx = -1;
+#if defined(HAVE_UTMPX_H)
+ char *wtmpx_file = NULL;
+ static int fdx = -1;
#if !defined(WTMPX_FILE) && defined(_PATH_WTMPX)
# define WTMPX_FILE _PATH_WTMPX
- pr_log_pri(PR_LOG_WARNING, "wtmpx %s: %s", WTMPX_FILE, strerror(errno));
- return -1;
- }
-+ if (wtmpx_file != NULL)
++ if (fdx >= 0 || wtmpx_file != NULL)
+ {
+#if defined(__sparcv9) && !defined(__NetBSD__)
+ struct futmpx utx;
+ struct utmpx utx;
+ time_t t;
+#endif
-+ static int fdx = -1;
- /* Unfortunately, utmp string fields are terminated by '\0' if they are
- * shorter than the size of the field, but if they are exactly the size of
- */
- if (fstat(fdx, &buf) == 0) {
- memset(&utx, 0, sizeof(utx));
-+ 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));
++ 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));
+ return -1;
+ }
+ if (write(fdx, (char *)&utx, sizeof(utx)) != sizeof(utx))
+ ftruncate(fdx, buf.st_size);
+ } else {
-+ pr_log_debug(DEBUG0, "%s fstat(): %s", WTMPX_FILE, strerror(errno));
++ pr_log_debug(DEBUG0, "%s fstat(): %s", wtmpx_file, strerror(errno));
+ res = -1;
+ }
+