diff options
author | Eric Andersen <andersen@codepoet.org> | 2004-07-30 17:24:47 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2004-07-30 17:24:47 +0000 |
commit | aad29b37a7345207c94e8ef9f0bac943d43dbe12 (patch) | |
tree | 5dc7bdc6d5ffd211abc3e76e8b43f2e53fba3e10 /loginutils/getty.c | |
parent | 15b588559bf75ebe15bc6ff29f3d591c4f35c0e8 (diff) | |
download | busybox-w32-aad29b37a7345207c94e8ef9f0bac943d43dbe12.tar.gz busybox-w32-aad29b37a7345207c94e8ef9f0bac943d43dbe12.tar.bz2 busybox-w32-aad29b37a7345207c94e8ef9f0bac943d43dbe12.zip |
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
Diffstat (limited to 'loginutils/getty.c')
-rw-r--r-- | loginutils/getty.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/loginutils/getty.c b/loginutils/getty.c index b211733ee..2b37136fe 100644 --- a/loginutils/getty.c +++ b/loginutils/getty.c | |||
@@ -228,7 +228,7 @@ static void termio_final(struct options *op, struct termio *tp, | |||
228 | 228 | ||
229 | struct chardata *cp); | 229 | struct chardata *cp); |
230 | static int caps_lock(const char *s); | 230 | static int caps_lock(const char *s); |
231 | static int bcode(const char *s); | 231 | static int bcode(char *s); |
232 | static void error(const char *fmt, ...) __attribute__ ((noreturn)); | 232 | static void error(const char *fmt, ...) __attribute__ ((noreturn)); |
233 | 233 | ||
234 | #ifdef CONFIG_FEATURE_U_W_TMP | 234 | #ifdef CONFIG_FEATURE_U_W_TMP |
@@ -503,6 +503,9 @@ static void update_utmp(char *line) | |||
503 | * utmp file can be opened for update, and if we are able to find our | 503 | * utmp file can be opened for update, and if we are able to find our |
504 | * entry in the utmp file. | 504 | * entry in the utmp file. |
505 | */ | 505 | */ |
506 | if (access(_PATH_UTMP, R_OK|W_OK) == -1) { | ||
507 | creat(_PATH_UTMP, O_RDWR); | ||
508 | } | ||
506 | utmpname(_PATH_UTMP); | 509 | utmpname(_PATH_UTMP); |
507 | setutent(); | 510 | setutent(); |
508 | while ((utp = getutent()) | 511 | while ((utp = getutent()) |
@@ -531,6 +534,9 @@ static void update_utmp(char *line) | |||
531 | endutent(); | 534 | endutent(); |
532 | 535 | ||
533 | { | 536 | { |
537 | if (access(_PATH_WTMP, R_OK|W_OK) == -1) { | ||
538 | creat(_PATH_WTMP, O_RDWR); | ||
539 | } | ||
534 | updwtmp(_PATH_WTMP, &ut); | 540 | updwtmp(_PATH_WTMP, &ut); |
535 | } | 541 | } |
536 | } | 542 | } |
@@ -953,7 +959,7 @@ static int caps_lock(const char *s) | |||
953 | } | 959 | } |
954 | 960 | ||
955 | /* bcode - convert speed string to speed code; return 0 on failure */ | 961 | /* bcode - convert speed string to speed code; return 0 on failure */ |
956 | static int bcode(const char *s) | 962 | static int bcode(char *s) |
957 | { | 963 | { |
958 | int r; | 964 | int r; |
959 | unsigned long value; | 965 | unsigned long value; |