aboutsummaryrefslogtreecommitdiffstats
path: root/mail/qmail
diff options
context:
space:
mode:
authorgarga <garga@FreeBSD.org>2010-01-19 18:26:57 +0800
committergarga <garga@FreeBSD.org>2010-01-19 18:26:57 +0800
commit893c9f01154dedace3414fcea7dcf0da6b076bd6 (patch)
tree56c1dee94022d8e9918487cee111dabd4e64b5d6 /mail/qmail
parent737bf05262c54e57a773faa6f697475176de590e (diff)
downloadfreebsd-ports-gnome-893c9f01154dedace3414fcea7dcf0da6b076bd6.tar.gz
freebsd-ports-gnome-893c9f01154dedace3414fcea7dcf0da6b076bd6.tar.zst
freebsd-ports-gnome-893c9f01154dedace3414fcea7dcf0da6b076bd6.zip
Fix build on 9-CURRENT after utmp -> utmpx
Provided by: ed@
Diffstat (limited to 'mail/qmail')
-rw-r--r--mail/qmail/Makefile4
-rw-r--r--mail/qmail/files/extra-patch-utmpx64
2 files changed, 68 insertions, 0 deletions
diff --git a/mail/qmail/Makefile b/mail/qmail/Makefile
index 852b5bf9c68c..b3ea145827cc 100644
--- a/mail/qmail/Makefile
+++ b/mail/qmail/Makefile
@@ -310,6 +310,10 @@ NO_MTREE= yes
.include <bsd.port.pre.mk>
+.if ${OSVERSION} >= 900007
+EXTRA_PATCHES+= ${FILESDIR}/extra-patch-utmpx
+.endif
+
.if defined(SLAVE_TLS)
CFLAGS+= -I${OPENSSLBASE}/include -L${OPENSSLBASE}/lib -DTLS
. if defined(WITH_TLS_DEBUG)
diff --git a/mail/qmail/files/extra-patch-utmpx b/mail/qmail/files/extra-patch-utmpx
new file mode 100644
index 000000000000..19bf40609a9f
--- /dev/null
+++ b/mail/qmail/files/extra-patch-utmpx
@@ -0,0 +1,64 @@
+--- qbiff.c
++++ qbiff.c
+@@ -1,13 +1,6 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+-#include <utmp.h>
+-#ifndef UTMP_FILE
+-#ifdef _PATH_UTMP
+-#define UTMP_FILE _PATH_UTMP
+-#else
+-#define UTMP_FILE "/etc/utmp"
+-#endif
+-#endif
++#include <utmpx.h>
+ #include "readwrite.h"
+ #include "stralloc.h"
+ #include "substdio.h"
+@@ -20,15 +13,12 @@
+ #include "env.h"
+ #include "exit.h"
+
+-substdio ssutmp;
+-char bufutmp[sizeof(struct utmp) * 16];
+-int fdutmp;
+ substdio sstty;
+ char buftty[1024];
+ int fdtty;
+
+-struct utmp ut;
+-char line[sizeof(ut.ut_line) + 1];
++struct utmpx *ut;
++char line[sizeof(ut->ut_line) + 1];
+ stralloc woof = {0};
+ stralloc tofrom = {0};
+ stralloc text = {0};
+@@ -63,7 +53,7 @@
+ if (!(user = env_get("USER"))) _exit(0);
+ if (!(sender = env_get("SENDER"))) _exit(0);
+ if (!(userext = env_get("LOCAL"))) _exit(0);
+- if (str_len(user) > sizeof(ut.ut_name)) _exit(0);
++ if (str_len(user) > sizeof(ut->ut_user)) _exit(0);
+
+ if (!stralloc_copys(&tofrom,"*** TO <")) _exit(0);
+ if (!stralloc_cats(&tofrom,userext)) _exit(0);
+@@ -88,15 +78,11 @@
+ if (!stralloc_cat(&woof,&text)) _exit(0);
+ if (!stralloc_cats(&woof,"\015\n")) _exit(0);
+
+- fdutmp = open_read(UTMP_FILE);
+- if (fdutmp == -1) _exit(0);
+- substdio_fdbuf(&ssutmp,read,fdutmp,bufutmp,sizeof(bufutmp));
+-
+- while (substdio_get(&ssutmp,&ut,sizeof(ut)) == sizeof(ut))
+- if (!str_diffn(ut.ut_name,user,sizeof(ut.ut_name)))
++ while ((ut = getutxent()) != NULL)
++ if (ut->ut_type == USER_PROCESS && !str_diffn(ut->ut_user,user,sizeof(ut->ut_user)))
+ {
+- byte_copy(line,sizeof(ut.ut_line),ut.ut_line);
+- line[sizeof(ut.ut_line)] = 0;
++ byte_copy(line,sizeof(ut->ut_line),ut->ut_line);
++ line[sizeof(ut->ut_line)] = 0;
+ if (line[0] == '/') continue;
+ if (!line[0]) continue;
+ if (line[str_chr(line,'.')]) continue;