$NetBSD: patch-aa,v 1.2 2010/07/19 12:32:24 sno Exp $ --- Utmp.xs.orig 2006-10-13 14:10:30.000000000 +0000 +++ Utmp.xs @@ -4,24 +4,24 @@ #include -#ifdef NOUTFUNCS +#ifdef _AIX +#define _HAVE_UT_HOST 1 +#endif -#include -#include -#include -#include -#include -#include -#include -#include +/* + It is almost certain that if these are not defined the fields they are + for are not present or this is BSD :) +*/ #ifdef BSD #define _NO_UT_ID #define _NO_UT_TYPE #define _NO_UT_PID #define ut_user ut_name +#define _HAVE_UT_HOST 1 #endif + /* define these so it still works as documented :) */ @@ -43,21 +43,15 @@ #endif -/* - It is almost certain that if these are not defined the fields they are - for are not present or this is BSD :) -*/ - - -#ifndef UT_LINESIZE -# define UT_LINESIZE 32 -#endif -#ifndef UT_NAMESIZE -# define UT_NAMESIZE 32 -#endif -#ifndef UT_HOSTSIZE -# define UT_HOSTSIZE -#endif +#ifdef NOUTFUNCS +#include +#include +#include +#include +#include +#include +#include +#include static int ut_fd = -1; @@ -207,7 +201,7 @@ SV *self static SV *ut_ref; static char *_ut_id; static struct utmp *utent; - static char ut_host[UT_HOSTSIZE]; + static char ut_host[sizeof(utent->ut_host)]; HV *self_hash; @@ -249,9 +243,9 @@ SV *self ut_tv = (IV)utent->ut_time; #endif #ifdef _HAVE_UT_HOST - strncpy(ut_host, utent->ut_host,UT_HOSTSIZE); + strncpy(ut_host, utent->ut_host,sizeof(utent->ut_host)); #else - strcpy(ut_host, "",1); + strncpy(ut_host, "",1); #endif