diff --git a/usr.sbin/bsdconfig/share/mustberoot.subr b/usr.sbin/bsdconfig/share/mustberoot.subr index a05ddc73b8be..e299fb25347e 100644 --- a/usr.sbin/bsdconfig/share/mustberoot.subr +++ b/usr.sbin/bsdconfig/share/mustberoot.subr @@ -176,8 +176,12 @@ f_become_root_via_sudo() retval=$? # Catch X11-related errors - [ $retval -eq 255 ] && + if [ $retval -eq 255 ]; then f_die $retval "$password" + elif [ $retval -ne 0 ]; then + # User cancelled + exit $retval + fi else password=$( $DIALOG \ --title "$DIALOG_TITLE" \