summaryrefslogtreecommitdiff
path: root/miscutils
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer2006-05-26 14:41:40 +0000
committerBernhard Reutner-Fischer2006-05-26 14:41:40 +0000
commit781e42d66c120183e4dea1058dc539bdc4c53651 (patch)
treeb139320b4b1275de767168b811ca45d1523f0573 /miscutils
parentb180e5a76678f697b2a368e2ef607d299d06a3ae (diff)
downloadbusybox-781e42d66c120183e4dea1058dc539bdc4c53651.zip
busybox-781e42d66c120183e4dea1058dc539bdc4c53651.tar.gz
- introduce and use bb_path_wtmp_file for portability (saves 11 Bytes).
- fix last.c to also look at the double-underscore UT_ defines.
Diffstat (limited to 'miscutils')
-rw-r--r--miscutils/last.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/miscutils/last.c b/miscutils/last.c
index ac6c86c..c10e1ea 100644
--- a/miscutils/last.c
+++ b/miscutils/last.c
@@ -26,7 +26,11 @@
* Do what we can while still keeping this reasonably small.
* Note: We are assuming the ut_id[] size is fixed at 4. */
-#if (UT_LINESIZE != 32) || (UT_NAMESIZE != 32) || (UT_HOSTSIZE != 256)
+#if defined UT_LINESIZE \
+ && ((UT_LINESIZE != 32) || (UT_NAMESIZE != 32) || (UT_HOSTSIZE != 256))
+#error struct utmp member char[] size(s) have changed!
+#elif defined __UT_LINESIZE \
+ && ((__UT_LINESIZE != 32) || (__UT_NAMESIZE != 64) || (__UT_HOSTSIZE != 256))
#error struct utmp member char[] size(s) have changed!
#endif
@@ -39,7 +43,7 @@ int last_main(int argc, char **argv)
if (argc > 1) {
bb_show_usage();
}
- file = bb_xopen(_PATH_WTMP, O_RDONLY);
+ file = bb_xopen(bb_path_wtmp_file, O_RDONLY);
printf("%-10s %-14s %-18s %-12.12s %s\n", "USER", "TTY", "HOST", "LOGIN", "TIME");
while ((n = safe_read(file, (void*)&ut, sizeof(struct utmp))) != 0) {