kdumpctl: Fix temporary directory location

The temporary directory is currently created under the current working
directory. That alone isn't ideal but works most of the time. However,
it will fail when the current working directory is not writable. So make
sure the directory is created within TMPDIR.

Fixes: ea00b7d ("kdumpctl: Move temp file in get_kernel_size to global temp dir")
Signed-off-by: Philipp Rudo <prudo@redhat.com>
Reviewed-by: Coiby Xu <coxu@redhat.com>
This commit is contained in:
Philipp Rudo 2023-06-19 14:31:48 +02:00 committed by Coiby Xu
parent 17c26558d9
commit dda81d72c2

View File

@ -45,7 +45,7 @@ if ! dlog_init; then
exit 1
fi
KDUMP_TMPDIR=$(mktemp -d kdump.XXXX)
KDUMP_TMPDIR=$(mktemp --tmpdir -d kdump.XXXX)
trap '
ret=$?;
rm -rf "$KDUMP_TMPDIR"