diff options
author | Miles Bader <miles@gnu.org> | 1996-07-03 05:22:21 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1996-07-03 05:22:21 +0000 |
commit | 74e1a5ff229f5cb7173ad770f8c41a5c6e878a25 (patch) | |
tree | 3cf352609dd285efa53215a4edd8aa6a9cd846b4 /login | |
parent | d746b89c44dea52eb329ff9417b34ad157d7e50e (diff) | |
download | glibc-74e1a5ff229f5cb7173ad770f8c41a5c6e878a25.tar.gz glibc-74e1a5ff229f5cb7173ad770f8c41a5c6e878a25.tar.xz glibc-74e1a5ff229f5cb7173ad770f8c41a5c6e878a25.zip |
(login): Only Frob OLD->ut_type if getutline_r actually found any entry. cvs/libc-960703
Diffstat (limited to 'login')
-rw-r--r-- | login/login.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/login/login.c b/login/login.c index ea1a947676..bbd3be92ce 100644 --- a/login/login.c +++ b/login/login.c @@ -116,7 +116,7 @@ login (const struct utmp *ut) strncpy (tmp.ut_line, ttyp, UT_LINESIZE); /* Read the record. */ - if (getutline_r (&tmp, &old, &data) >= 0 || errno == ESRCH) + if (getutline_r (&tmp, &old, &data) >= 0) { #if _HAVE_UT_TYPE - 0 /* We have to fake the old entry because this `login' @@ -126,6 +126,10 @@ login (const struct utmp *ut) #endif pututline_r (ut, &data); } + else if (errno == ESRCH) + /* We didn't find anything. pututline_r will add UT at the end + of the file in this case. */ + pututline_r (ut, &data); /* Close UTMP file. */ endutent_r (&data); |