From 8c5e758191710e03499a3e2198134acb6ad6e71d Mon Sep 17 00:00:00 2001 From: Badlop Date: Sat, 3 Apr 2021 17:51:14 +0200 Subject: [PATCH] Fix recent commit 9adadc6: mkdir shouldn't run with exec --- ecs/bin/ejabberdctl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ecs/bin/ejabberdctl b/ecs/bin/ejabberdctl index b06f475..6515d70 100755 --- a/ecs/bin/ejabberdctl +++ b/ecs/bin/ejabberdctl @@ -115,6 +115,13 @@ export CONTRIB_MODULES_CONF_DIR export ERL_LIBS # run command either directly or via su $INSTALLUSER +cmd() +{ + case $EXEC_CMD in + as_install_user) su -s /bin/sh -c '"$0" "$@"' "$INSTALLUSER" -- "$@" ;; + as_current_user) "$@" ;; + esac +} exec_cmd() { case $EXEC_CMD in @@ -263,7 +270,7 @@ wait_status() } # ensure we can change current directory to SPOOL_DIR -[ -d "$SPOOL_DIR" ] || exec_cmd mkdir -p "$SPOOL_DIR" +[ -d "$SPOOL_DIR" ] || cmd mkdir -p "$SPOOL_DIR" cd "$SPOOL_DIR" || { echo "ERROR: can not access directory $SPOOL_DIR" exit 6