the 'who' and 'last' applets among other things to work as expected.
-Erik
config CONFIG_WHO
bool "who"
default n
+ select CONFIG_FEATURE_U_W_TMP
help
who is used to show who is logged on.
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
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
* 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())
endutent();
{
+ if (access(_PATH_WTMP, R_OK|W_OK) == -1) {
+ creat(_PATH_WTMP, O_RDWR);
+ }
updwtmp(_PATH_WTMP, &ut);
}
}
}
/* 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;
#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 \
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 */
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.