Skip to content

Commit ab160db

Browse files
sylwaremichal42
authored andcommitted
scripts: fix link-vmlinux.sh bash-ism
While building linux with dash shell: LINK vmlinux trap: SIGHUP: bad trap /src/linux-4.0/Makefile:933: recipe for target 'vmlinux' failed make[1]: *** [vmlinux] Error 1 See the following document for behavior of posix shell trap instruction: http://pubs.opengroup.org/onlinepubs/000095399/utilities/trap.html Cc: Ingo Molnar <mingo@kernel.org> Signed-off-by: Sylvain BERTRAND <sylvain.bertrand@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
1 parent ee4eb20 commit ab160db

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

‎scripts/link-vmlinux.sh‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ sortextable()
111111
}
112112

113113
# Delete output files in case of error
114-
trap cleanup SIGHUP SIGINT SIGQUIT SIGTERM ERR
115114
cleanup()
116115
{
117116
rm -f .old_version
@@ -124,6 +123,20 @@ cleanup()
124123
rm -f vmlinux.o
125124
}
126125

126+
on_exit()
127+
{
128+
if [ $? -ne 0 ]; then
129+
cleanup
130+
fi
131+
}
132+
trap on_exit EXIT
133+
134+
on_signals()
135+
{
136+
exit 1
137+
}
138+
trap on_signals HUP INT QUIT TERM
139+
127140
#
128141
#
129142
# Use "make V=1" to debug this script
@@ -231,7 +244,6 @@ if [ -n "${CONFIG_KALLSYMS}" ]; then
231244
if ! cmp -s System.map .tmp_System.map; then
232245
echo >&2 Inconsistent kallsyms data
233246
echo >&2 Try "make KALLSYMS_EXTRA_PASS=1" as a workaround
234-
cleanup
235247
exit 1
236248
fi
237249
fi

0 commit comments

Comments
 (0)