summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattia Rizzolo <mattia@debian.org>2017-11-06 14:42:19 +0100
committerMattia Rizzolo <mattia@debian.org>2017-11-06 14:45:31 +0100
commitc45bf9c48100cb6ceb273fc474af52aa1f20721f (patch)
tree9fb9c2fcb2c090235fff9c24cca8e2667b4b74d6
parent8bb1c48d65126dd24064930b070a68ff68347cf0 (diff)
downloadjenkins.debian.net-c45bf9c48100cb6ceb273fc474af52aa1f20721f.tar.xz
udd-query: remove the temporary file with a trap
in case this script is called with the wrong argument, and in case of failures, etc, the temporary file would be left around otherwise Signed-off-by: Mattia Rizzolo <mattia@debian.org>
-rwxr-xr-xbin/udd-query.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/bin/udd-query.sh b/bin/udd-query.sh
index 0efb18e8..fb62c8cb 100755
--- a/bin/udd-query.sh
+++ b/bin/udd-query.sh
@@ -62,7 +62,6 @@ multiarch_versionskew() {
# TODO: show versions (per arch) too
done
fi
- rm $UDD
}
orphaned_without_o_bug() {
@@ -95,13 +94,15 @@ orphaned_without_o_bug() {
done
fi
- rm -f "$UDD" "$WNPPRM" "$SORTED_UDD"
+ rm -f "$WNPPRM" "$SORTED_UDD"
}
#
# main
#
UDD=$(mktemp)
+function rmtmpfile { rm -f "$UDD"; }
+trap rmtmpfile exit
case $1 in
orphaned_without_o_bug)
orphaned_without_o_bug