diff options
author | Jordi Sanfeliu <jordi@fibranet.cat> | 2018-07-27 12:02:55 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2018-07-30 10:36:49 +0300 |
commit | 613a7f90361533fd5310ee836635a1e0864dfa71 (patch) | |
tree | f5924f59ca958d327dae6fca27901266d3754c5d /newlib/libc/unix | |
parent | 7e09931ad95a10d15b7a93b49faeadfe25f63464 (diff) |
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.
Diffstat (limited to 'newlib/libc/unix')
-rw-r--r-- | newlib/libc/unix/getut.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/newlib/libc/unix/getut.c b/newlib/libc/unix/getut.c index 89ed7390f..71a8c8f4f 100644 --- a/newlib/libc/unix/getut.c +++ b/newlib/libc/unix/getut.c @@ -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: |