Skip to content

Commit

Permalink
gen_initramfs.sh: remove intermediate cpio_list on errors
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
masahir0y committed Jan 15, 2020
1 parent 65e00e0 commit 7168965
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion usr/gen_initramfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -243,4 +245,3 @@ if test -n "$KBUILD_BUILD_TIMESTAMP"; then
fi
fi
usr/gen_init_cpio $timestamp $cpio_list > $output
rm $cpio_list

0 comments on commit 7168965

Please sign in to comment.