summaryrefslogtreecommitdiff
path: root/login/utmp_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'login/utmp_file.c')
-rw-r--r--login/utmp_file.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/login/utmp_file.c b/login/utmp_file.c
index a0b0aa4346..9a5d687291 100644
--- a/login/utmp_file.c
+++ b/login/utmp_file.c
@@ -231,7 +231,9 @@ proc_utmp_eq (const struct utmp *entry, const struct utmp *match)
&&
#endif
#if _HAVE_UT_ID - 0
- strncmp (entry->ut_id, match->ut_id, sizeof match->ut_id) == 0
+ (entry->ut_id[0] && match->ut_id[0]
+ ? strncmp (entry->ut_id, match->ut_id, sizeof match->ut_id) == 0
+ : strncmp (entry->ut_line, match->ut_line, sizeof match->ut_line) == 0)
#else
strncmp (entry->ut_line, match->ut_line, sizeof match->ut_line) == 0
#endif