Fix comparison between two character arrays

Hello,

The member 'id' in the 'utmp' struct is not a numeric but a character array,
hence the strncmp() function is needed to compare two members.
This commit is contained in:
Jordi Sanfeliu 2018-07-27 11:02:55 +02:00 committed by Corinna Vinschen
parent 7e09931ad9
commit 613a7f9036
1 changed files with 1 additions and 1 deletions

View File

@ -63,7 +63,7 @@ getutid (struct utmp *id)
case LOGIN_PROCESS:
case USER_PROCESS:
case DEAD_PROCESS:
if (id->ut_id == utmp_data.ut_id)
if (!strncmp (id->ut_id, utmp_data.ut_id, sizeof (utmp_data.ut_id)))
return &utmp_data;
break;
default: