Skip Menu |

This queue is for tickets about the Sys-Utmp CPAN distribution.

Report information
The Basics
Id: 52369
Status: resolved
Priority: 0/
Queue: Sys-Utmp

People
Owner: Nobody in particular
Requestors: FERRENCY [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.6
Fixed in: (no value)



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
On Wed Dec 02 13:14:25 2009, FERRENCY wrote: Show quoted text
> 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 >
Thanks applied with https://github.com/jonathanstowe/Sys-Utmp/commit/7220a3401c03f447e26de0ffa63ab72349fc96b3