Initialise variable size so that reading stdin works deterministically.

Add missing include.

Default to WARNS=6.
This commit is contained in:
David Malone 2007-05-03 13:57:19 +00:00
parent d7a1f74bec
commit 61f31ed6cf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=169235
2 changed files with 5 additions and 2 deletions

View File

@ -2,5 +2,6 @@
# $FreeBSD$
PROG= lastcomm
WARNS?= 6
.include <bsd.prog.mk>

View File

@ -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))