aboutsummaryrefslogtreecommitdiff
path: root/scripts/Makefile.compiler
diff options
context:
space:
mode:
authorGravatar Masahiro Yamada <masahiroy@kernel.org> 2022-07-28 12:14:33 +0900
committerGravatar Masahiro Yamada <masahiroy@kernel.org> 2022-08-03 22:56:38 +0900
commitdd29865633a5535889568b5f38f74a445c227e5d (patch)
treebc9c00770da51637468122ca5b621d5626a35951 /scripts/Makefile.compiler
parentmodpost: remove unused Elf_Sword macro (diff)
downloadlinux-dd29865633a5535889568b5f38f74a445c227e5d.tar.gz
linux-dd29865633a5535889568b5f38f74a445c227e5d.tar.bz2
linux-dd29865633a5535889568b5f38f74a445c227e5d.zip
kbuild: set EXIT trap before creating temporary directory
Swap the order of 'mkdir' and 'trap' just in case the subshell is interrupted between 'mkdir' and 'trap' although the effect might be subtle. This does not intend to make the cleanup perfect. There are more cases that miss to remove the tmp directory, for example: - When interrupted, dash does not invoke the EXIT trap (bash does) - 'rm' command might be interrupted before removing the directory I am not addressing all the cases since the tmp directory is harmless after all. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Diffstat (limited to 'scripts/Makefile.compiler')
-rw-r--r--scripts/Makefile.compiler2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/Makefile.compiler b/scripts/Makefile.compiler
index 86ecd2ac874c..94d0d40cddb3 100644
--- a/scripts/Makefile.compiler
+++ b/scripts/Makefile.compiler
@@ -21,8 +21,8 @@ TMPOUT = $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_$$$$
# automatically cleaned up.
try-run = $(shell set -e; \
TMP=$(TMPOUT)/tmp; \
- mkdir -p $(TMPOUT); \
trap "rm -rf $(TMPOUT)" EXIT; \
+ mkdir -p $(TMPOUT); \
if ($(1)) >/dev/null 2>&1; \
then echo "$(2)"; \
else echo "$(3)"; \