[prev in list] [next in list] [prev in thread] [next in thread] 

List:       qmail
Subject:    patch: utmpx for qbiff
From:       Amitai Schlair <schmonz () schmonz ! com>
Date:       2008-04-19 3:35:10
Message-ID: 03A61AA5-625C-4340-8C81-AFF673CCC1B0 () schmonz ! com
[Download RAW message or body]

I'm lucky enough to have a system wherein OpenSSH updates only utmpx,  
and not also utmp. This prevents qbiff from firing. Just in case it's  
useful for anyone else, here's a quick patch for qbiff to build with  
utmpx support on systems that have it.


["qbiff-utmpx.diff" (qbiff-utmpx.diff)]

--- Makefile.orig	2008-04-18 23:16:11.000000000 -0400
+++ Makefile
@@ -685,6 +685,13 @@ chkshsgr warn-shsgr tryshsgr.c compile l
 	hasshsgr.h
 	rm -f tryshsgr.o tryshsgr
 
+hasutmpx.h: \
+tryutmpx.c compile load
+	( ( ./compile tryutmpx.c && ./load tryutmpx ) >/dev/null \
+	2>&1 \
+	&& echo \#define HASUTMPX 1 || exit 0 ) > hasutmpx.h
+	rm -f tryutmpx.o tryutmpx
+
 haswaitp.h: \
 trywaitp.c compile load
 	( ( ./compile trywaitp.c && ./load trywaitp ) >/dev/null \
@@ -1072,7 +1079,8 @@ qbiff.1
 
 qbiff.o: \
 compile qbiff.c readwrite.h stralloc.h gen_alloc.h substdio.h subfd.h \
-substdio.h open.h byte.h str.h headerbody.h hfield.h env.h exit.h
+substdio.h open.h byte.h str.h headerbody.h hfield.h env.h exit.h \
+hasutmpx.h
 	./compile qbiff.c
 
 qmail-clean: \
--- qbiff.c.orig	1998-06-15 06:53:16.000000000 -0400
+++ qbiff.c
@@ -1,5 +1,19 @@
 #include <sys/types.h>
 #include <sys/stat.h>
+#include "hasutmpx.h"
+#ifdef HASUTMPX
+#define _UTMPX_COMPAT 1
+#define utmp utmpx
+#define UTMP_FILE UTMPX_FILE
+#include <utmpx.h>
+#ifndef UTMPX_FILE
+#ifdef _PATH_UTMPX
+#define UTMPX_FILE _PATH_UTMPX
+#else
+#define UTMPX_FILE "/etc/utmpx"
+#endif
+#endif
+#else
 #include <utmp.h>
 #ifndef UTMP_FILE
 #ifdef _PATH_UTMP
@@ -8,6 +22,7 @@
 #define UTMP_FILE "/etc/utmp"
 #endif
 #endif
+#endif
 #include "readwrite.h"
 #include "stralloc.h"
 #include "substdio.h"
--- tryutmpx.c.orig	2008-04-18 23:21:07.000000000 -0400
+++ tryutmpx.c
@@ -0,0 +1,6 @@
+#include <utmpx.h>
+
+void main()
+{
+  ;
+}




[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic