File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -410,12 +410,12 @@ active_sessions_count(const char *name, unsigned long limit)
410
410
if (USER_PROCESS != ut -> ut_type ) {
411
411
continue ;
412
412
}
413
- if ('\0' == ut -> ut_user [ 0 ]) {
413
+ if (strncmp ( ut -> ut_user , "" , NITEMS ( ut -> ut_user )) == 0 )
414
414
continue ;
415
- }
416
- if (strncmp ( name , ut -> ut_user , sizeof (ut -> ut_user )) != 0 ) {
415
+
416
+ if (strncmp ( ut -> ut_user , name , NITEMS (ut -> ut_user )) != 0 )
417
417
continue ;
418
- }
418
+
419
419
count ++ ;
420
420
if (count > limit ) {
421
421
break ;
Original file line number Diff line number Diff line change 13
13
#include <fcntl.h>
14
14
#include <signal.h>
15
15
#include <stdio.h>
16
+ #include <string.h>
16
17
#include <sys/stat.h>
17
18
#include <sys/types.h>
18
19
#include <utmpx.h>
@@ -178,9 +179,9 @@ main(int argc, char **argv)
178
179
if (ut -> ut_type != USER_PROCESS ) {
179
180
continue ;
180
181
}
181
- if (ut -> ut_user [ 0 ] == '\0' ) {
182
+ if (strncmp ( ut -> ut_user , "" , NITEMS ( ut -> ut_user )) == 0 )
182
183
continue ;
183
- }
184
+
184
185
if (check_login (ut )) {
185
186
continue ;
186
187
}
You can’t perform that action at this time.
0 commit comments