From c88bdaea06120b11bf033ed6cb25d4c598920307 Mon Sep 17 00:00:00 2001 From: javalsai Date: Wed, 11 Jun 2025 17:04:42 +0200 Subject: [PATCH] fix: no human users found --- src/users.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/users.c b/src/users.c index bc38413..3f32aef 100644 --- a/src/users.c +++ b/src/users.c @@ -46,7 +46,9 @@ struct Vector get_human_users() { struct passwd* NULLABLE pwd; while ((pwd = getpwent()) != NULL) { - if (!pwd->pw_dir || strcmp(pwd->pw_dir, "/home/") != 0) continue; + // `- 1` bcs sizeof counts the nullbyte + if (pwd->pw_dir && strncmp(pwd->pw_dir, "/home/", sizeof("/home/") - 1) != 0) + continue; struct user* user_i = malloc(sizeof(struct user)); if (user_i == NULL) continue; // malloc error