From 200321cf9b01aa057182c27005542ce33e73ca38 Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Thu, 19 Dec 2024 16:59:41 -0700 Subject: [PATCH] error handling --- usr/local/share/bastille/top.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/usr/local/share/bastille/top.sh b/usr/local/share/bastille/top.sh index 7cc4713a..34f7fa71 100644 --- a/usr/local/share/bastille/top.sh +++ b/usr/local/share/bastille/top.sh @@ -42,16 +42,15 @@ case "${1}" in ;; esac -# Accept only one argument -if [ $# -eq 0 ] || [ $# -gt 1 ]; then +if [ $# -ne 1 ]; then usage fi TARGET="${1}" + bastille_root_check set_target_single "${TARGET}" -check_target_exists "${TARGET}" -check_target_is_running "${TARGET}" +check_target_is_running "${TARGET}" || exit bastille_jail_path="$(/usr/sbin/jls -j "${TARGET}" path)" if [ ! -x "${bastille_jail_path}/usr/local/bin/top" ]; then