Initialise variable size so that reading stdin works deterministically.
Add missing include. Default to WARNS=6.
This commit is contained in:
parent
d7a1f74bec
commit
61f31ed6cf
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=169235
@ -2,5 +2,6 @@
|
||||
# $FreeBSD$
|
||||
|
||||
PROG= lastcomm
|
||||
WARNS?= 6
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user