From 75e34c53d41274fce2fbdeace81e4f58878a2379 Mon Sep 17 00:00:00 2001 From: Neha Oudin Date: Thu, 3 Oct 2024 12:18:09 +0200 Subject: [PATCH] fix: cd before exec for argument --- snap/local/drop_priv.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/snap/local/drop_priv.sh b/snap/local/drop_priv.sh index a258b23..f0b4034 100755 --- a/snap/local/drop_priv.sh +++ b/snap/local/drop_priv.sh @@ -3,15 +3,15 @@ export PBM_MONGODB_URI="$(snapctl get pbm-uri)" + + if [[ $(id -u) == "0" ]]; then - exec bash -c "cd ${SNAP} && \ - ${SNAP}/usr/bin/setpriv \ + cd ${SNAP} && exec "${SNAP}"/usr/bin/setpriv \ --clear-groups \ --reuid snap_daemon \ --regid snap_daemon \ -- \ - ${SNAP}/usr/bin/$*" + "${SNAP}/usr/bin/$@" else - exec bash -c "cd ${SNAP} && \ - ${SNAP}/usr/bin/$*" + cd ${SNAP} && exec "${SNAP}/usr/bin/$@" fi