diff options
author | dds <dds@FreeBSD.org> | 2007-04-18 09:39:47 +0000 |
---|---|---|
committer | dds <dds@FreeBSD.org> | 2007-04-18 09:39:47 +0000 |
commit | 0e40cc602a84ada7b0d048a17e1a6258b38cd966 (patch) | |
tree | 9712ca3f5ac517bd43046175ab6cdc6bceaadeab /usr.bin | |
parent | c7e7d9561a6743e70667d899ed0b8e9adb997d27 (diff) | |
download | FreeBSD-src-0e40cc602a84ada7b0d048a17e1a6258b38cd966.zip FreeBSD-src-0e40cc602a84ada7b0d048a17e1a6258b38cd966.tar.gz |
Complain on write errors.
Use correct type for write_text.
MFC after: 8 days
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/lastcomm/lastcomm.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/lastcomm/lastcomm.c b/usr.bin/lastcomm/lastcomm.c index 4218858..9d51537 100644 --- a/usr.bin/lastcomm/lastcomm.c +++ b/usr.bin/lastcomm/lastcomm.c @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include <err.h> #include <fcntl.h> #include <pwd.h> +#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -91,7 +92,7 @@ main(int argc, char *argv[]) int ch; const char *acctfile; int flags = 0; - int write_text = 0; + bool write_text = false; acctfile = _PATH_ACCT; while ((ch = getopt(argc, argv, "f:uwsecSE")) != -1) @@ -103,7 +104,7 @@ main(int argc, char *argv[]) flags |= AC_UTIME; /* user time */ break; case 'w': - write_text = 1; /* user time */ + write_text = true; /* export */ break; case 's': flags |= AC_STIME; /* system time */ @@ -232,6 +233,9 @@ main(int argc, char *argv[]) printf("\n"); } while (size > 0); + + if (fflush(stdout)) + err(1, "stdout"); exit(0); } |