summaryrefslogtreecommitdiffstats
path: root/login-utils/agetty.c
diff options
context:
space:
mode:
authorKarel Zak2006-12-07 00:26:00 +0100
committerKarel Zak2006-12-07 00:26:00 +0100
commitf0c8eda12c410fb56630de47f6d50cac15f7529a (patch)
tree4531e56b1873ce6b4e5db4bf4684f5daa4e1257e /login-utils/agetty.c
parentImported from util-linux-2.11t tarball. (diff)
downloadkernel-qcow2-util-linux-f0c8eda12c410fb56630de47f6d50cac15f7529a.tar.gz
kernel-qcow2-util-linux-f0c8eda12c410fb56630de47f6d50cac15f7529a.tar.xz
kernel-qcow2-util-linux-f0c8eda12c410fb56630de47f6d50cac15f7529a.zip
Imported from util-linux-2.11u tarball.
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));