Fix `trap` in a few shell scripts

The original `trap` lines in these scripts are incomplete: in case of
any signal, they delete the working directory but let the script run to
completion, which is useless because it will only proceed to complain
about the working directory being removed.  Add `exit` there, with the
original exit value (not rm's).

Since this is mostly just cosmetic, no backpatch.

Discussion: https://postgr.es/m/20220913181002.hzsosy7qkemb7ky7@alvherre.pgsql
This commit is contained in:
Alvaro Herrera 2022-09-20 18:50:16 +02:00
parent 152c9f7b8f
commit 3d53b9ef1a
No known key found for this signature in database
GPG Key ID: 1C20ACB9D5C564AE
5 changed files with 7 additions and 7 deletions

View File

@ -2,7 +2,7 @@
# src/tools/find_static
trap "rm -f /tmp/$$" 0 1 2 3 15
trap "ret=$?; rm -rf /tmp/$$; exit $ret" 0 1 2 3 15
# This script finds functions that are either never called, or
# should be static.

View File

@ -5,7 +5,7 @@
command -v ctags >/dev/null || \
{ echo "'ctags' program not found" 1>&2; exit 1; }
trap "rm -f /tmp/$$" 0 1 2 3 15
trap "ret=$?; rm -rf /tmp/$$; exit $ret" 0 1 2 3 15
rm -f ./tags
IS_EXUBERANT=""

View File

@ -50,7 +50,7 @@ done
# Create temp directory.
tmp=`mktemp -d /tmp/$me.XXXXXX`
trap 'rm -rf $tmp' 0 1 2 3 15
trap "ret=$?; rm -rf $tmp; exit $ret" 0 1 2 3 15
exit_status=0

View File

@ -46,7 +46,7 @@ CPPFLAGS=`echo "$CPPFLAGS" | sed "s|\\\$(PG_SYSROOT)|$PG_SYSROOT|g"`
# Create temp directory.
tmp=`mktemp -d /tmp/$me.XXXXXX`
trap 'rm -rf $tmp' 0 1 2 3 15
trap "ret=$?; rm -rf $tmp; exit $ret" 0 1 2 3 15
exit_status=0
@ -154,9 +154,9 @@ do
EXTRAINCLUDES="$python_includespec" ;;
src/interfaces/ecpg/*)
EXTRAINCLUDES="-I $builddir/src/interfaces/ecpg/include -I $srcdir/src/interfaces/ecpg/include" ;;
src/backend/parser/*)
src/backend/parser/*)
EXTRAINCLUDES="-I $builddir/src/backend/parser/" ;;
src/backend/utils/adt/*)
src/backend/utils/adt/*)
EXTRAINCLUDES="-I $builddir/src/backend/utils/adt/" ;;
*)
EXTRAINCLUDES="" ;;

View File

@ -14,7 +14,7 @@ MAKE="make"
[ ! -d src ] && echo "This must be run from the top of the PostgreSQL source tree" 1>&2 && exit 1
trap "rm -rf /tmp/$$" 0 1 2 3 15
trap "ret=$?; rm -rf /tmp/$$; exit $ret" 0 1 2 3 15
mkdir /tmp/$$
TMP="/tmp/$$"