commit f9efcbfdc2d47795d193c9a851a9c4b6d41661d5
parent ea3a0e4107ab96c1f7916a05a4d9b9412f506c66
Author: Amitai Schleier <schmonz-web-git@schmonz.com>
Date: Mon, 5 Aug 2019 21:20:05 -0400
Fix the non-compiling utmp case, found on OpenBSD.
By not having build-tested with utmp, I made two easy mistakes:
(1) In file included from qbiff.c:3:
./qtmp.h:15:5: error: unknown type name 'substdio'
substdio ssutmp; \
^
./qtmp.h:16:43: error: expected ';' after top level declarator
char bufutmp[sizeof(struct utmp) * 16]
^
;
Mistake: missed a trailing backslash on line 14.
Fix: add it.
(2) qbiff.c:81:2: error: use of undeclared identifier 'fdutmp'; did you mean 'ssutmp'?
UTMP_OPEN;
^
./qtmp.h:20:33: note: expanded from macro 'UTMP_OPEN'
substdio_fdbuf(&ssutmp,read,fdutmp,bufutmp,sizeof(bufutmp))
Mistake: tried to get rid of fdutmp by checking open_read() directly,
not realizing fdutmp was still needed on the next line (!).
Fix: bring back fdutmp.
Fixes: 47baf7859ec511c4939fbf5b44e292bb60485aac
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/qtmp.h1 b/qtmp.h1
@@ -11,12 +11,14 @@
#endif
#define UTMP_INIT \
struct utmp utm; \
- struct utmp *ut = &utm;
+ struct utmp *ut = &utm; \
substdio ssutmp; \
- char bufutmp[sizeof(struct utmp) * 16]
+ char bufutmp[sizeof(struct utmp) * 16]; \
+ int fdutmp
#define UTMP_USER ut_name
#define UTMP_OPEN \
- if (open_read(UTMP_FILE) == -1) _exit(0); \
+ fdutmp = open_read(UTMP_FILE); \
+ if (fdutmp == -1) _exit(0); \
substdio_fdbuf(&ssutmp,read,fdutmp,bufutmp,sizeof(bufutmp))
#define UTMP_READ_MORE (substdio_get(&ssutmp,ut,sizeof(utm)) == sizeof(utm))
#define UTMP_TYPE_MATCHES 1