client: Write temporary files in /tmp
All checks were successful
gitea/evobackup/pipeline/head This commit looks good

By default "mktemp" creates a temporary file in the current working directory,
which in the context of Debian's cron is /. To avoid littering /, we add the
option "--tmpdir" that use $TMPDIR or /tmp instead.
This commit is contained in:
Brice Waegeneire 2024-03-22 10:05:10 +01:00
parent 9510546d48
commit 21533c6fb9

View file

@ -399,8 +399,8 @@ build_rsync_main_cmd() {
###################################################################
# Create a temp file for excludes and includes
includes_file="$(mktemp "${PROGNAME}.includes.XXXXXX")"
excludes_file="$(mktemp "${PROGNAME}.excludes.XXXXXX")"
includes_file="$(mktemp --tmpdir "${PROGNAME}.includes.XXXXXX")"
excludes_file="$(mktemp --tmpdir "${PROGNAME}.excludes.XXXXXX")"
# … and add them to the list of files to delete at exit
temp_files="${includes_file} ${excludes_file}"
trap "rm -f ${temp_files}" EXIT