[BusyBox-cvs] CVS update of busybox (coreutils/Config.in loginutils/Config.in loginutils/getty.c loginutils/login.c miscutils/Config.in)
Erik Andersen
andersen at codepoet.org
Fri Jul 30 17:24:47 UTC 2004
Date: Friday, July 30, 2004 @ 11:24:47
Author: andersen
Path: /var/cvs/busybox
Modified: coreutils/Config.in (1.24 -> 1.25) loginutils/Config.in (1.7 ->
1.8) loginutils/getty.c (1.11 -> 1.12) loginutils/login.c (1.17
-> 1.18) miscutils/Config.in (1.17 -> 1.18)
Fixup getty, login, etc so the utmp and wtmp are updated, allowing
the 'who' and 'last' applets among other things to work as expected.
-Erik
Index: busybox/coreutils/Config.in
diff -u busybox/coreutils/Config.in:1.24 busybox/coreutils/Config.in:1.25
--- busybox/coreutils/Config.in:1.24 Mon Mar 15 01:28:19 2004
+++ busybox/coreutils/Config.in Fri Jul 30 11:24:46 2004
@@ -538,6 +538,7 @@
config CONFIG_WHO
bool "who"
default n
+ select CONFIG_FEATURE_U_W_TMP
help
who is used to show who is logged on.
Index: busybox/loginutils/Config.in
diff -u busybox/loginutils/Config.in:1.7 busybox/loginutils/Config.in:1.8
--- busybox/loginutils/Config.in:1.7 Wed Oct 22 03:58:25 2003
+++ busybox/loginutils/Config.in Fri Jul 30 11:24:47 2004
@@ -57,6 +57,15 @@
help
getty lets you log in on a tty, it is normally invoked by init.
+config CONFIG_FEATURE_U_W_TMP
+ bool " Support utmp and wtmp files"
+ depends on CONFIG_GETTY || CONFIG_LOGIN || CONFIG_SU || CONFIG_WHO || CONFIG_LAST
+ default n
+ help
+ The files /var/run/utmp and /var/run/wtmp can be used to track when
+ user's have logged into and logged out of the system, allowing programs
+ such as 'who' and 'last' to list who is currently logged in.
+
config CONFIG_LOGIN
bool "login"
default n
Index: busybox/loginutils/getty.c
diff -u busybox/loginutils/getty.c:1.11 busybox/loginutils/getty.c:1.12
--- busybox/loginutils/getty.c:1.11 Tue Jun 22 04:07:16 2004
+++ busybox/loginutils/getty.c Fri Jul 30 11:24:47 2004
@@ -228,7 +228,7 @@
struct chardata *cp);
static int caps_lock(const char *s);
-static int bcode(const char *s);
+static int bcode(char *s);
static void error(const char *fmt, ...) __attribute__ ((noreturn));
#ifdef CONFIG_FEATURE_U_W_TMP
@@ -503,6 +503,9 @@
* utmp file can be opened for update, and if we are able to find our
* entry in the utmp file.
*/
+ if (access(_PATH_UTMP, R_OK|W_OK) == -1) {
+ creat(_PATH_UTMP, O_RDWR);
+ }
utmpname(_PATH_UTMP);
setutent();
while ((utp = getutent())
@@ -531,6 +534,9 @@
endutent();
{
+ if (access(_PATH_WTMP, R_OK|W_OK) == -1) {
+ creat(_PATH_WTMP, O_RDWR);
+ }
updwtmp(_PATH_WTMP, &ut);
}
}
@@ -953,7 +959,7 @@
}
/* bcode - convert speed string to speed code; return 0 on failure */
-static int bcode(const char *s)
+static int bcode(char *s)
{
int r;
unsigned long value;
Index: busybox/loginutils/login.c
diff -u busybox/loginutils/login.c:1.17 busybox/loginutils/login.c:1.18
--- busybox/loginutils/login.c:1.17 Wed Apr 14 11:51:19 2004
+++ busybox/loginutils/login.c Fri Jul 30 11:24:47 2004
@@ -403,8 +403,6 @@
#ifdef CONFIG_FEATURE_U_W_TMP
// vv Taken from tinylogin utmp.c vv
-#define _WTMP_FILE "/var/log/wtmp"
-
#define NO_UTENT \
"No utmp entry. You must exec \"login\" from the lowest level \"sh\""
#define NO_TTY \
@@ -480,6 +478,9 @@
setutent();
pututline(&utent);
endutent();
- updwtmp(_WTMP_FILE, &utent);
+ if (access(_PATH_WTMP, R_OK|W_OK) == -1) {
+ creat(_PATH_WTMP, O_RDWR);
+ }
+ updwtmp(_PATH_WTMP, &utent);
}
#endif /* CONFIG_FEATURE_U_W_TMP */
Index: busybox/miscutils/Config.in
diff -u busybox/miscutils/Config.in:1.17 busybox/miscutils/Config.in:1.18
--- busybox/miscutils/Config.in:1.17 Tue Jul 20 02:07:10 2004
+++ busybox/miscutils/Config.in Fri Jul 30 11:24:46 2004
@@ -83,6 +83,7 @@
config CONFIG_LAST
bool "last"
default n
+ select CONFIG_FEATURE_U_W_TMP
help
'last' displays a list of the last users that logged into the system.
More information about the busybox-cvs
mailing list