Date: Sun, 28 Jun 2026 18:40:34 +0000 From: Baptiste Daroussin <bapt@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 2dd4c50deeaf - stable/15 - pw: fix inverted condition in shell_path error handling Message-ID: <6a416aa2.1cd82.4121dab@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=2dd4c50deeaf9007c181ccaf063bac298c8ae78d commit 2dd4c50deeaf9007c181ccaf063bac298c8ae78d Author: Baptiste Daroussin <bapt@FreeBSD.org> AuthorDate: 2026-06-04 22:12:35 +0000 Commit: Baptiste Daroussin <bapt@FreeBSD.org> CommitDate: 2026-06-28 18:32:26 +0000 pw: fix inverted condition in shell_path error handling (cherry picked from commit 4fd8a69ec6623da5ef33818be134efffebe37f75) --- usr.sbin/pw/pw_user.c | 2 +- usr.sbin/pw/tests/pw_useradd_test.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.sbin/pw/pw_user.c b/usr.sbin/pw/pw_user.c index 413eac4882cc..dcf870ca1edc 100644 --- a/usr.sbin/pw/pw_user.c +++ b/usr.sbin/pw/pw_user.c @@ -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; diff --git a/usr.sbin/pw/tests/pw_useradd_test.sh b/usr.sbin/pw/tests/pw_useradd_test.sh index 75e96a64ba8e..4b0778759203 100755 --- a/usr.sbin/pw/tests/pw_useradd_test.sh +++ b/usr.sbin/pw/tests/pw_useradd_test.sh @@ -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_existshome | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a416aa2.1cd82.4121dab>
