From 9bb125a79a492945d63a1509b80173d7740b1411 Mon Sep 17 00:00:00 2001 From: dwmalone Date: Thu, 3 May 2007 13:57:19 +0000 Subject: Initialise variable size so that reading stdin works deterministically. Add missing include. Default to WARNS=6. --- usr.bin/lastcomm/Makefile | 1 + usr.bin/lastcomm/lastcomm.c | 6 ++++-- 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 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 #include #include +#include #include #include #include @@ -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)) -- cgit v1.1