Page MenuHomeFreeBSD

D41424.id125861.diff
No OneTemporary

D41424.id125861.diff

diff --git a/usr.bin/last/last.c b/usr.bin/last/last.c
--- a/usr.bin/last/last.c
+++ b/usr.bin/last/last.c
@@ -48,7 +48,7 @@
#include <sys/stat.h>
#include <capsicum_helpers.h>
-#include <err.h>
+
#include <errno.h>
#include <fcntl.h>
#include <langinfo.h>
@@ -118,7 +118,7 @@
xo_error(
"usage: last [-swy] [-d [[CC]YY][MMDD]hhmm[.SS]] [-f file] [-h host]\n"
" [-n maxrec] [-t tty] [user ...]\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
int
@@ -132,8 +132,7 @@
argc = xo_parse_args(argc, argv);
if (argc < 0)
- exit(1);
- atexit(xo_finish_atexit);
+ exit(EXIT_FAILURE);
maxrec = -1;
snaptime = 0;
@@ -150,8 +149,11 @@
if (p == NULL)
p = strchr(argv[optind], ch);
maxrec = atol(p);
- if (!maxrec)
- exit(0);
+ if (!maxrec) {
+ if (xo_finish() < 0)
+ xo_err(EXIT_FAILURE, "stdout");
+ exit(EXIT_SUCCESS);
+ }
}
break;
case 'd':
@@ -217,7 +219,9 @@
}
}
wtmp();
- exit(0);
+ if (xo_finish() < 0)
+ xo_err(EXIT_FAILURE, "stdout");
+ exit(EXIT_SUCCESS);
}
/*
@@ -290,8 +294,11 @@
* shutdown/reboot appears while we are tracking the
* active range
*/
- if (snaptime && snapfound)
- exit(0);
+ if (snaptime && snapfound) {
+ if (xo_finish() < 0)
+ xo_err(EXIT_FAILURE, "stdout");
+ exit(EXIT_SUCCESS);
+ }
/*
* don't print shutdown/reboot entries unless flagged for
*/
@@ -352,8 +359,11 @@
time_t delta; /* time difference */
time_t t;
- if (maxrec != -1 && !maxrec--)
- exit(0);
+ if (maxrec != -1 && !maxrec--) {
+ if (xo_finish() < 0)
+ xo_err(EXIT_FAILURE, "stdout");
+ exit(EXIT_SUCCESS);
+ }
xo_open_instance("last");
t = bp->ut_tv.tv_sec;
tm = localtime(&t);

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 28, 11:03 PM (12 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26307199
Default Alt Text
D41424.id125861.diff (1 KB)

Event Timeline