--- Utmp.xs.orig	2006-10-13 16:10:30.000000000 +0200
+++ Utmp.xs	2009-02-13 13:45:12.000000000 +0100
@@ -4,8 +4,11 @@
 
 #include <utmp.h>
 
-#ifdef NOUTFUNCS
+#ifdef _AIX
+#define _HAVE_UT_HOST	1
+#endif
 
+#ifdef NOUTFUNCS
 #include <stdlib.h>
 #include <unistd.h>
 #include <time.h>
@@ -15,6 +18,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 
+
 #ifdef BSD
 #define _NO_UT_ID
 #define _NO_UT_TYPE
@@ -42,23 +46,12 @@
 #define ACCOUNTING      9
 #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
-
 static int ut_fd = -1;
 
 static char _ut_name[] = _PATH_UTMP;
@@ -207,7 +200,7 @@
      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 +242,9 @@
        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
 
 
