pw: fix inverted condition in shell_path error handling

This commit is contained in:
Baptiste Daroussin
2026-06-05 00:12:35 +02:00
parent 13f4a37b53
commit 4fd8a69ec6
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -464,7 +464,7 @@ shell_path(char const * path, char *shells[], char *sh)
return shellpath;
}
}
if (sh == NULL)
if (sh != NULL)
errx(EX_OSFILE, "can't find shell `%s' in shell paths", sh);
errx(EX_CONFIG, "no default shell available or defined");
return NULL;
+1 -1
View File
@@ -402,7 +402,7 @@ user_add_bad_shell_body() {
populate_etc_skel
atf_check -s exit:0 ${PW} useradd foo -s sh
atf_check -s exit:78 -e ignore ${PW} useradd bar -s badshell
atf_check -s exit:72 -e inline:"pw: can't find shell \`badshell' in shell paths\n" ${PW} useradd bar -s badshell
}
atf_test_case user_add_already_exists