aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1996-07-26 21:03:47 +0000
committerMiles Bader <miles@gnu.org>1996-07-26 21:03:47 +0000
commit4627647c99b7c269e1a325bd2beb1467589fb074 (patch)
tree8637d974f66c2bf55ed3add7276d8b20d6a0c834
parent(getutid_r): Mark UTMP_DATA->loc_utmp invalid if a search fails. (diff)
downloadglibc-4627647c99b7c269e1a325bd2beb1467589fb074.tar.gz
glibc-4627647c99b7c269e1a325bd2beb1467589fb074.tar.bz2
glibc-4627647c99b7c269e1a325bd2beb1467589fb074.zip
Fri Jul 26 16:10:43 1996 Miles Bader <miles@gnu.ai.mit.edu>
* 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.
-rw-r--r--ChangeLog7
-rw-r--r--login/pututline_r.c5
2 files changed, 10 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 770d06e208..915f2e95d7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Fri Jul 26 16:10:43 1996 Miles Bader <miles@gnu.ai.mit.edu>
+
+ * 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.
+
Fri Jul 26 00:36:50 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* sysdeps/mips/dl-machine.h: New file, contributed by Kazumoto Kojima
diff --git a/login/pututline_r.c b/login/pututline_r.c
index 42994e899f..ada6059aae 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. */