summaryrefslogtreecommitdiffstats
path: root/adduser/adduser.sh
diff options
context:
space:
mode:
authorPeter Pentchev <roam@FreeBSD.org>2004-09-23 13:09:42 +0000
committerPeter Pentchev <roam@FreeBSD.org>2004-09-23 13:09:42 +0000
commit59fd6541b608c1f683af5af0e09dd8d600622ac3 (patch)
tree66a5b79979d9a111ec85b112b8e5a901f383cd05 /adduser/adduser.sh
parent000ed5efb47015170cb46e5f333cf320af770e6d (diff)
downloadpw-darwin-59fd6541b608c1f683af5af0e09dd8d600622ac3.tar.gz
pw-darwin-59fd6541b608c1f683af5af0e09dd8d600622ac3.tar.zst
pw-darwin-59fd6541b608c1f683af5af0e09dd8d600622ac3.zip
In fullpath_from_shell(), move the nologin detection before the cat | while
loop to avoid an incorrect display of the nologin path twice. PR: 71786 Submitted by: Andrew Hayden <andrew.hayden@gmail.com> Reviewed by: mtm MFC after: 3 days
Diffstat (limited to 'adduser/adduser.sh')
-rw-r--r--adduser/adduser.sh18
1 files changed, 11 insertions, 7 deletions
diff --git a/adduser/adduser.sh b/adduser/adduser.sh
index 050f2b1..0014e4c 100644
--- a/adduser/adduser.sh
+++ b/adduser/adduser.sh
@@ -126,6 +126,17 @@ fullpath_from_shell() {
_shell=$1
[ -z "$_shell" ] && return 1
+ # /usr/sbin/nologin is a special case; it needs to be handled
+ # before the cat | while loop, since a 'return' from within
+ # a subshell will not terminate the function's execution, and
+ # the path to the nologin shell might be printed out twice.
+ #
+ if [ "$_shell" = "${NOLOGIN}" -o \
+ "$_shell" = "${NOLOGIN_PATH}" ]; then
+ echo ${NOLOGIN_PATH}
+ return 0;
+ fi
+
cat ${ETCSHELLS} |
while read _path _junk ; do
case "$_path" in
@@ -141,13 +152,6 @@ fullpath_from_shell() {
esac
done
- # /usr/sbin/nologin is a special case
- if [ "$_shell" = "${NOLOGIN}" -o \
- "$_shell" = "${NOLOGIN_PATH}" ]; then
- echo ${NOLOGIN_PATH}
- return 0;
- fi
-
return 1
}