Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jan 2010 02:16:51 GMT
From:      Rob Farmer <rfarmer@predatorlabs.net>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/143240: [PATCH] sysutils/nctop utmp.h --> utmpx.h
Message-ID:  <201001260216.o0Q2GpU2082684@www.freebsd.org>
Resent-Message-ID: <201001260220.o0Q2K6LT042933@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         143240
>Category:       ports
>Synopsis:       [PATCH] sysutils/nctop utmp.h --> utmpx.h
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 26 02:20:06 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Rob Farmer
>Release:        9.0-CURRENT
>Organization:
>Environment:
FreeBSD pentium4.predatorlabs.net 9.0-CURRENT FreeBSD 9.0-CURRENT #0 r202659: Tue Jan 19 16:02:39 PST 2010     rfarmer@pentium4.predatorlabs.net:/obj/usr/src/sys/PENTIUM4  i386
>Description:
Convert from utmp.h to utmpx.h
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

diff -ruN nctop.old/Makefile nctop/Makefile
--- nctop.old/Makefile	2010-01-25 16:45:33.000000000 -0800
+++ nctop/Makefile	2010-01-25 16:57:21.000000000 -0800
@@ -24,4 +24,11 @@
 
 MAN1=		nctopd.1 nctop.1
 
-.include <bsd.port.mk>
+.include <bsd.port.pre.mk>
+
+.if ${OSVERSION} > 900006
+post-configure:
+	${PATCH} ${PATCH_ARGS} machine.c < ${PATCHDIR}/utmpx-machine.c
+.endif
+
+.include <bsd.port.post.mk>
diff -ruN nctop.old/files/utmpx-machine.c nctop/files/utmpx-machine.c
--- nctop.old/files/utmpx-machine.c	1969-12-31 16:00:00.000000000 -0800
+++ nctop/files/utmpx-machine.c	2010-01-25 16:49:41.000000000 -0800
@@ -0,0 +1,33 @@
+--- machine.c.orig	2010-01-25 16:46:11.000000000 -0800
++++ machine.c	2010-01-25 16:49:17.000000000 -0800
+@@ -16,7 +16,7 @@
+ #include <stdlib.h>
+ #include <ctype.h>
+ #include <sys/types.h>
+-#include <utmp.h>
++#include <utmpx.h>
+ #include <kvm.h>
+ #include <fcntl.h>
+ #include <sys/sysctl.h>
+@@ -101,17 +101,12 @@
+ 	/* nusers */
+ 	{
+ 
+-	struct utmp utmp;
++	struct utmpx utmp;
+ 
+-	if ((stream = fopen(_PATH_UTMP,"r")) == NULL) {
+-		perror(_PATH_UTMP);
+-	} else {
+-		for (hoststat.nusers=0; fread(&utmp,sizeof(utmp),1,stream);) {
+-			if (utmp.ut_name[0] != '\0') {
+-				++hoststat.nusers;
+-			}
++	for (hoststat.nusers=0; fread(&utmp,sizeof(utmp),1,stream);) {
++		if (utmp.ut_user[0] != '\0') {
++			++hoststat.nusers;
+ 		}
+-		fclose(stream);
+ 	}
+ 	}
+ 


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001260216.o0Q2GpU2082684>