Check for "NONEXISTENT" in "src/pwck.c"

This commit is contained in:
Jason Franklin 2020-05-08 13:20:14 -04:00
parent c56fe7117b
commit c040058fe3
No known key found for this signature in database
GPG Key ID: E55F751316A343B0

View File

@ -527,14 +527,18 @@ static void check_pw_file (int *errors, bool *changed)
* Make sure the home directory exists
*/
if (!quiet && (access (pwd->pw_dir, F_OK) != 0)) {
const char *nonexistent = getdef_str("NONEXISTENT");
/*
* Home directory doesn't exist, give a warning
* Home directory does not exist, give a warning (unless intentional)
*/
if (NULL == nonexistent || strcmp (pwd->pw_dir, nonexistent) != 0) {
printf (_("user '%s': directory '%s' does not exist\n"),
pwd->pw_name, pwd->pw_dir);
*errors += 1;
}
}
}
/*
* Make sure the login shell is executable