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:
parent
7e09931ad9
commit
613a7f9036
|
@ -63,7 +63,7 @@ getutid (struct utmp *id)
|
||||||
case LOGIN_PROCESS:
|
case LOGIN_PROCESS:
|
||||||
case USER_PROCESS:
|
case USER_PROCESS:
|
||||||
case DEAD_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;
|
return &utmp_data;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue