pkgsrc/sysutils/p5-Sys-Utmp/patches/patch-aa
sno 64606415da Updating sysutils/p5-Sys-Utmp from 1.6 to 1.6nb1 to remark some fixes:
- Fix Utmp.xs to compile on NetBSD (fixes PR pkg/42082)
- Apply patch from RT#52369 (FreeBSD 7.2: compilation error and host support)
  see https://rt.cpan.org/Ticket/Display.html?id=52369
2010-07-19 12:32:24 +00:00

90 lines
1.7 KiB
Text

$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 <utmp.h>
-#ifdef NOUTFUNCS
+#ifdef _AIX
+#define _HAVE_UT_HOST 1
+#endif
-#include <stdlib.h>
-#include <unistd.h>
-#include <time.h>
-#include <string.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
+/*
+ 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 <stdlib.h>
+#include <unistd.h>
+#include <time.h>
+#include <string.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
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