mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-23 03:10:05 +00:00
(login): Only Frob OLD->ut_type if getutline_r actually found any entry.
This commit is contained in:
parent
d746b89c44
commit
74e1a5ff22
@ -116,7 +116,7 @@ login (const struct utmp *ut)
|
|||||||
strncpy (tmp.ut_line, ttyp, UT_LINESIZE);
|
strncpy (tmp.ut_line, ttyp, UT_LINESIZE);
|
||||||
|
|
||||||
/* Read the record. */
|
/* Read the record. */
|
||||||
if (getutline_r (&tmp, &old, &data) >= 0 || errno == ESRCH)
|
if (getutline_r (&tmp, &old, &data) >= 0)
|
||||||
{
|
{
|
||||||
#if _HAVE_UT_TYPE - 0
|
#if _HAVE_UT_TYPE - 0
|
||||||
/* We have to fake the old entry because this `login'
|
/* We have to fake the old entry because this `login'
|
||||||
@ -126,6 +126,10 @@ login (const struct utmp *ut)
|
|||||||
#endif
|
#endif
|
||||||
pututline_r (ut, &data);
|
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. */
|
/* Close UTMP file. */
|
||||||
endutent_r (&data);
|
endutent_r (&data);
|
||||||
|
Loading…
Reference in New Issue
Block a user