summaryrefslogtreecommitdiffstats
path: root/usr.bin/lastcomm
diff options
context:
space:
mode:
authordwmalone <dwmalone@FreeBSD.org>2007-05-03 13:57:19 +0000
committerdwmalone <dwmalone@FreeBSD.org>2007-05-03 13:57:19 +0000
commit9bb125a79a492945d63a1509b80173d7740b1411 (patch)
treec95717bb23fb127ec2170d1345f3b8b4a33c6894 /usr.bin/lastcomm
parent2a0c0b82dd77f2aedefb7a0a06a4598236c18d51 (diff)
downloadFreeBSD-src-9bb125a79a492945d63a1509b80173d7740b1411.zip
FreeBSD-src-9bb125a79a492945d63a1509b80173d7740b1411.tar.gz
Initialise variable size so that reading stdin works deterministically.
Add missing include. Default to WARNS=6.
Diffstat (limited to 'usr.bin/lastcomm')
-rw-r--r--usr.bin/lastcomm/Makefile1
-rw-r--r--usr.bin/lastcomm/lastcomm.c6
2 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/lastcomm/Makefile b/usr.bin/lastcomm/Makefile
index 13f0fe6..be75109 100644
--- a/usr.bin/lastcomm/Makefile
+++ b/usr.bin/lastcomm/Makefile
@@ -2,5 +2,6 @@
# $FreeBSD$
PROG= lastcomm
+WARNS?= 6
.include <bsd.prog.mk>
diff --git a/usr.bin/lastcomm/lastcomm.c b/usr.bin/lastcomm/lastcomm.c
index 386f94f..f53923f 100644
--- a/usr.bin/lastcomm/lastcomm.c
+++ b/usr.bin/lastcomm/lastcomm.c
@@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
#include <ctype.h>
#include <err.h>
#include <fcntl.h>
+#include <grp.h>
#include <pwd.h>
#include <stdbool.h>
#include <stdio.h>
@@ -139,9 +140,10 @@ main(int argc, char *argv[])
argc -= optind;
argv += optind;
- if (strcmp(acctfile, "-") == 0)
+ if (strcmp(acctfile, "-") == 0) {
fp = stdin;
- else {
+ size = sizeof(struct acct); /* Always one more to read. */
+ } else {
/* Open the file. */
if ((fp = fopen(acctfile, "r")) == NULL ||
fstat(fileno(fp), &sb))
OpenPOWER on IntegriCloud