Subject: | FreeBSD 7.2: compilation error and host support |
In FreeBSD 7.2, Sys::Utmp fails to compile, because of a parameter error
here:
#ifdef _HAVE_UT_HOST
strncpy(ut_host, utent->ut_host,UT_HOSTSIZE);
#else
strcpy(ut_host, "",1);
#endif
The strcpy() should be strncpy(). I think you'll clear up a lot of your
CPAN Testers reports by fixing that.
However, we also found that using Sys::Utmp's getutent() does provide
access to the host field in FreeBSD 7.2, if you let it.
The patch below fixes the strcpy typo, and adds _HAVE_UT_HOST for BSD.
I do not know if this will break on other BSD's.
Starting as early as 2001 (FreeBSD 2.2.7?) and up until FreeBSD 6.2,
Sys::Utmp did provide us with the host results we expected. It only
stopped working in 7.2 when we adopted Sys::Utmp 1.5 (because 1.6
wouldn't compile until this patch).
Thanks for the useful module!
Alan Ferrency
pair Networks
--- Utmp.xs~ 2006-10-13 10:10:30.000000000 -0400
+++ Utmp.xs 2009-12-02 13:03:49.000000000 -0500
@@ -19,6 +19,7 @@
#define _NO_UT_ID
#define _NO_UT_TYPE
#define _NO_UT_PID
+#define _HAVE_UT_HOST
#define ut_user ut_name
#endif
@@ -251,7 +252,7 @@
#ifdef _HAVE_UT_HOST
strncpy(ut_host, utent->ut_host,UT_HOSTSIZE);
#else
- strcpy(ut_host, "",1);
+ strncpy(ut_host, "",1);
#endif