[OpenWrt-Devel,1/4] scripts/clean-package.sh: exit in case cd fails
diff mbox series

Message ID 20191230034827.22185-1-rosenp@gmail.com
State New
Headers show
Series
  • [OpenWrt-Devel,1/4] scripts/clean-package.sh: exit in case cd fails
Related show

Commit Message

Rosen Penev Dec. 30, 2019, 3:48 a.m. UTC
Found with shellcheck.

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

Patch
diff mbox series

diff --git a/scripts/clean-package.sh b/scripts/clean-package.sh
index 6dd9bf7306..987e6685a8 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
 		[ -f "$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