]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
gen_initramfs.sh: remove intermediate cpio_list on errors
authorMasahiro Yamada <masahiroy@kernel.org>
Sat, 4 Jan 2020 15:02:38 +0000 (00:02 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Wed, 15 Jan 2020 15:26:22 +0000 (00:26 +0900)
This script sets the -e option, so it exits on any error, in which
case it exits without cleaning up the intermediate cpio_list.

Make sure to delete it on exit.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
usr/gen_initramfs.sh

index 4e6715f8ff7f1e0c2eacd6e7834de99e1877a9b6..8ae831657e5d86d5abe18ebd32e868484b65baab 100755 (executable)
@@ -193,6 +193,8 @@ dep_list=
 cpio_list=$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX)
 output="/dev/stdout"
 
+trap "rm -f $cpio_list" EXIT
+
 while [ $# -gt 0 ]; do
        arg="$1"
        shift
@@ -243,4 +245,3 @@ if test -n "$KBUILD_BUILD_TIMESTAMP"; then
        fi
 fi
 usr/gen_init_cpio $timestamp $cpio_list > $output
-rm $cpio_list