Don't require root privileges just to show a "No command specified" error
Check if a profile or command is specified before looking at EUID.
This commit is contained in:
parent
55cfb8ba02
commit
b6241cb1d0
@ -827,16 +827,16 @@ while getopts 'p:r:C:L:P:A:D:w:o:s:c:g:vh?' arg; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if (( OPTIND <= 1 )); then
|
||||||
|
_msg_error "No command specified" 0
|
||||||
|
_usage 1
|
||||||
|
fi
|
||||||
|
|
||||||
if (( EUID != 0 )); then
|
if (( EUID != 0 )); then
|
||||||
_msg_error "${app_name} must be run as root." 1
|
_msg_error "${app_name} must be run as root." 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
shift $((OPTIND - 1))
|
shift $((OPTIND - 1))
|
||||||
|
|
||||||
if (( $# < 1 )); then
|
|
||||||
_msg_error "No command specified" 0
|
|
||||||
_usage 1
|
|
||||||
fi
|
|
||||||
command_name="${1}"
|
command_name="${1}"
|
||||||
|
|
||||||
# Set directory path defaults for legacy commands
|
# Set directory path defaults for legacy commands
|
||||||
|
Loading…
Reference in New Issue
Block a user