about summary refs log tree commit diff
path: root/login
diff options
context:
space:
mode:
Diffstat (limited to 'login')
-rw-r--r--login/pututline_r.c5
1 files changed, 3 insertions, 2 deletions
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.  */