Skip to content

Commit a405ea7

Browse files
ensure ut_user field is checked
Signed-off-by: Hui Li <[email protected]>
1 parent 1e8ec7b commit a405ea7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: os.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ void get_current_users(struct os_metrics *input_os_metrics) {
204204

205205
while ((input_utmpx = getutxent()) != NULL) {
206206
/* check users who are established and authenticated */
207-
if (input_utmpx->ut_type == USER_PROCESS || input_utmpx->ut_type == LOGIN_PROCESS) {
207+
if ((input_utmpx->ut_type == USER_PROCESS || input_utmpx->ut_type == LOGIN_PROCESS) && input_utmpx->ut_user[0] != '\0') {
208208
++input_os_metrics->current_users;
209209
}
210210
}

0 commit comments

Comments
 (0)