diff options
author | Miles Bader <miles@gnu.org> | 1996-06-11 18:17:13 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1996-06-11 18:17:13 +0000 |
commit | 1447416cef137e169ddb0ddb2d6186c904a30142 (patch) | |
tree | 14537307e3d0bc2dd42643559d900de9f93b33bc /utils/login.c | |
parent | 1450f1d74a944fb111f705d050087fc1016d29a9 (diff) |
(dog): Don't print stupid message if login session is empty.
(add_utmp_entry): Use gettimeofday instead of time to get the time.
Diffstat (limited to 'utils/login.c')
-rw-r--r-- | utils/login.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/utils/login.c b/utils/login.c index 7ff1aa60..c291575c 100644 --- a/utils/login.c +++ b/utils/login.c @@ -195,7 +195,7 @@ add_utmp_entry (char *args, unsigned args_len, int tty_fd, int inherit_host) bzero (&utmp, sizeof (utmp)); - time (&utmp.ut_time); + gettimeofday (&utmp.ut_tv, 0); strncpy (utmp.ut_name, envz_get (args, args_len, "USER") ?: "", sizeof (utmp.ut_name)); strncpy (utmp.ut_line, tty, sizeof (utmp.ut_line)); @@ -327,13 +327,22 @@ dog (time_t timeout, pid_t pid) processes, &c, but oh well; they can be set non-executable by nobody). */ { - size_t num_pids = 20, i; + size_t num_pids = 20; pid_t _pids[num_pids], *pids = _pids; + err = proc_getloginpids (proc_server, pid, &pids, &num_pids); if (! err) - for (i = 0; i < num_pids; i++) - if (check_owned (proc_server, pids[i], &owned) == 0 && owned) - exit (0); /* Give up, luser wins. */ + { + int i; + + if (num_pids == 0) + exit (0); /* Login already aborted. Die silently. */ + + for (i = 0; i < num_pids; i++) + if (check_owned (proc_server, pids[i], &owned) == 0 && owned) + exit (0); /* Give up, luser wins. */ + } + /* None are owned. Kill session after emitting cryptic, yet stupid, message. */ putc ('\n', stderr); |