Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F162587178
D44871.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D44871.diff
View Options
diff --git a/usr.sbin/adduser/adduser.sh b/usr.sbin/adduser/adduser.sh
--- a/usr.sbin/adduser/adduser.sh
+++ b/usr.sbin/adduser/adduser.sh
@@ -59,12 +59,11 @@
_nextuid="$(${PWCMD} usernext | cut -f1 -d:)"
else
while : ; do
- ${PWCMD} usershow $_uid > /dev/null 2>&1
- if [ ! "$?" -eq 0 ]; then
+ if ! ${PWCMD} usershow $_uid > /dev/null 2>&1; then
_nextuid=$_uid
break
fi
- _uid=$(($_uid + 1))
+ _uid=$((_uid + 1))
done
fi
echo $_nextuid
@@ -262,8 +261,7 @@
if [ -n "$BSDINSTALL_CHROOT" ]; then
create_zfs_chrooted_dataset
else
- create_zfs_dataset
- if [ "$?" -ne 0 ]; then
+ if ! create_zfs_dataset; then
err "There was an error adding user ($username)."
return 1
fi
@@ -354,8 +352,7 @@
err "You must enter a username!"
[ -z "$fflag" ] && continue
fi
- ${PWCMD} usershow "$_input" > /dev/null 2>&1
- if [ "$?" -eq 0 ]; then
+ if ${PWCMD} usershow "$_input" > /dev/null 2>&1; then
err "User exists!"
[ -z "$fflag" ] && continue
fi
@@ -476,19 +473,20 @@
# so, enable ZFS home dataset creation.
#
get_zfs_home() {
+ local _prefix
+
# check if zfs kernel module is loaded before attempting to run zfs to
# prevent loading the kernel module on systems that don't use ZFS
- if ! "$KLDSTATCMD" -q -m zfs; then
+ if ! "$KLDSTATCMD" -q -m zfs ||
Zcreate="no"
return
fi
- zfs_homeprefix=$(${ZFSCMD} list -Ho name "${homeprefix}" 2>/dev/null)
- if [ "$?" -ne 0 ]; then
- Zcreate="no"
- elif [ -z "${zfs_homeprefix}" ]; then
+ if ! _prefix=$(${ZFSCMD} list -Ho name "${homeprefix}" 2>/dev/null) ||
+ [ -z "${_prefix}" ]; then
Zcreate="no"
+ return
fi
- zhome="${zfs_homeprefix}/${username}"
+ zhome="${_prefix}/${username}"
}
# get_uid
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jul 15, 7:54 PM (9 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35111998
Default Alt Text
D44871.diff (1 KB)
Attached To
Mode
D44871: adduser: A few more improvements.
Attached
Detach File
Event Timeline
Log In to Comment