summaryrefslogtreecommitdiffstats
path: root/login-utils/agetty.c
diff options
context:
space:
mode:
Diffstat (limited to 'login-utils/agetty.c')
-rw-r--r--login-utils/agetty.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/login-utils/agetty.c b/login-utils/agetty.c
index d53811b2a..f9f33b535 100644
--- a/login-utils/agetty.c
+++ b/login-utils/agetty.c
@@ -572,9 +572,16 @@ update_utmp(line)
utmpname(_PATH_UTMP);
setutent();
- while ((utp = getutent())
- && !(utp->ut_type == INIT_PROCESS
- && utp->ut_pid == mypid)) /* nothing */;
+
+ /* Find mypid in utmp. Earlier code here tested only
+ utp->ut_type != INIT_PROCESS, so maybe the >= here should be >.
+ The present code is taken from login.c, so if this is changed,
+ maybe login has to be changed as well. */
+ while ((utp = getutent()))
+ if (utp->ut_pid == mypid
+ && utp->ut_type >= INIT_PROCESS
+ && utp->ut_type <= DEAD_PROCESS)
+ break;
if (utp) {
memcpy(&ut, utp, sizeof(ut));