(getutid_r): Mark UTMP_DATA->loc_utmp invalid if a search fails.

This commit is contained in:
Miles Bader 1996-07-26 21:01:48 +00:00
parent fa8463e5ed
commit d4eaba51e7

View File

@ -65,6 +65,7 @@ getutid_r (const struct utmp *id, struct utmp **utmp,
if (read (utmp_data->ut_fd, &utmp_data->ubuf, sizeof (struct utmp)) if (read (utmp_data->ut_fd, &utmp_data->ubuf, sizeof (struct utmp))
!= sizeof (struct utmp)) != sizeof (struct utmp))
{ {
utmp_data->loc_utmp = 0; /* Mark loc_utmp invalid. */
errno = ESRCH; errno = ESRCH;
return -1; return -1;
} }
@ -87,6 +88,7 @@ getutid_r (const struct utmp *id, struct utmp **utmp,
if (read (utmp_data->ut_fd, &utmp_data->ubuf, sizeof (struct utmp)) if (read (utmp_data->ut_fd, &utmp_data->ubuf, sizeof (struct utmp))
!= sizeof (struct utmp)) != sizeof (struct utmp))
{ {
utmp_data->loc_utmp = 0; /* Mark loc_utmp invalid. */
errno = ESRCH; errno = ESRCH;
return -1; return -1;
} }