[PATCHv2 1/4] scripts/clean-package.sh: exit in case cd fails

Rosen Penev rosenp at gmail.com
Sat Jul 11 14:45:25 EDT 2020


Found with shellcheck.

Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 v2: rebased
 scripts/clean-package.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/clean-package.sh b/scripts/clean-package.sh
index 035725625d..cbd12d8799 100755
--- a/scripts/clean-package.sh
+++ b/scripts/clean-package.sh
@@ -9,14 +9,14 @@ IFS=$'\n'
 	exit 1
 }
 cat "$1" | (
-	cd "$2"
+	cd "$2" || exit 1
 	while read entry; do
 		[ -n "$entry" ] || break
 		[ ! -d "$entry" ] || [ -L "$entry" ] && rm -f "$entry"
 	done
 )
 sort -r "$1" | (
-	cd "$2"
+	cd "$2" || exit 1
 	while read entry; do
 		[ -n "$entry" ] || break
 		[ -d "$entry" ] && rmdir "$entry" > /dev/null 2>&1
-- 
2.26.2




More information about the openwrt-devel mailing list