From 4627647c99b7c269e1a325bd2beb1467589fb074 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Fri, 26 Jul 1996 21:03:47 +0000 Subject: Fri Jul 26 16:10:43 1996 Miles Bader * login/pututline_r.c (pututline_r): Only call getutid_r if ID has a valid ut_id field. * login/getutid_r.c (getutid_r): Mark UTMP_DATA->loc_utmp invalid if a search fails. --- login/pututline_r.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'login') diff --git a/login/pututline_r.c b/login/pututline_r.c index 42994e8..ada6059 100644 --- a/login/pututline_r.c +++ b/login/pututline_r.c @@ -62,8 +62,9 @@ pututline_r (const struct utmp *id, struct utmp_data *utmp_data) /* Check whether we need to reposition. Repositioning is necessary either if the data in UTMP_DATA is not valid or if the ids don't match: */ - if (utmp_data->loc_utmp < (off_t) sizeof (struct utmp) - || strncmp(utmp_data->ubuf.ut_id, id->ut_id, sizeof (id->ut_id)) != 0) + if (id->ut_id[0] + && (utmp_data->loc_utmp < (off_t) sizeof (struct utmp) + || strncmp(utmp_data->ubuf.ut_id, id->ut_id, sizeof (id->ut_id)) != 0)) { /* We must not overwrite the data in UTMP_DATA since ID may be aliasing it. */ -- cgit v1.1