From 8c4ae5b0f1b839dea40d7aae40de5e15b325ff35 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Tue, 3 Mar 2015 18:21:06 +0100 Subject: [PATCH] subcommand: Avoid referencing possibly undefined $ret. If a subcommand does not set $ret (like the minimal "hello" example does), and sets the nounset bash option (set -u), gsu aborts at the attempt to reference $ret. Fix this flaw by setting $ret to $GSU_SUCCESS prior to calling the subcommand. Reported by Congmao Wang. --- subcommand | 1 + 1 file changed, 1 insertion(+) diff --git a/subcommand b/subcommand index 3ff31f0..261e35f 100644 --- a/subcommand +++ b/subcommand @@ -549,6 +549,7 @@ gsu() # external commands for i in $gsu_cmds; do if test "$arg" = "$i"; then + ret=$GSU_SUCCESS com_$arg "$@" if (("$ret" < 0)); then gsu_err_msg -- 2.39.2