commitpkg: properly cleanup commit msg file on abort

Use the workdir location which gets cleaned up automatically. Previously
this was leaking tmpfiles if the commitpkg command got aborted after
file creation.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
This commit is contained in:
Levente Polyak 2023-01-12 21:33:00 +01:00
parent 009c58f7c9
commit d45e77738b
No known key found for this signature in database
GPG Key ID: FC1B547C8D8172C8
1 changed files with 2 additions and 1 deletions

View File

@ -132,7 +132,8 @@ if [[ -n $(svn status -q) ]]; then
svn commit -q -m "${msgtemplate}: ${1}" || die
stat_done
else
msgfile="$(mktemp)"
[[ -z ${WORKDIR:-} ]] && setup_workdir
msgfile=$(mktemp --tmpdir="${WORKDIR}" commitpkg.XXXXXXXXXX)
echo "$msgtemplate" > "$msgfile"
if [[ -n $SVN_EDITOR ]]; then
$SVN_EDITOR "$msgfile"