summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Fink2026-02-24 21:16:50 +0100
committerDennis Fink2026-02-24 21:16:50 +0100
commit1176ccc0345e6c04b9eae9cdf71851fe05204f32 (patch)
tree7915062cb4335ff3e501354408ca64a3cd894c06
parentc9f7b81f013eca9d25d956f1f644c05ec9814ae0 (diff)
downloadtranscode.sh-1176ccc0345e6c04b9eae9cdf71851fe05204f32.tar.gz
transcode.sh-1176ccc0345e6c04b9eae9cdf71851fe05204f32.zip
fix(core): use mktemp for temporary output file creation
Replaces $$.$RANDOM with mktemp, which provides cryptographically random names and atomic file creation.
Diffstat (limited to '')
-rwxr-xr-xtranscode.sh4
1 files changed, 3 insertions, 1 deletions
diff --git a/transcode.sh b/transcode.sh
index 500111d..a25bc6a 100755
--- a/transcode.sh
+++ b/transcode.sh
@@ -690,7 +690,9 @@ encode_one() {
# Temp file is created in the same directory as the input so that `mv` is
# atomic on the same filesystem (avoid cross-device rename issues).
- tmp="$directory/.${stem}_$PRESET_NAME.$$.$RANDOM${extension:+.$extension}"
+ # mktemp provides cryptographically random names and atomic creation,
+ # unlike $$.$RANDOM which has limited entropy and is predictable.
+ tmp=$(mktemp -- "$directory/.${stem}_${PRESET_NAME}.XXXXXX${extension:+.$extension}")
TMP_FILES+=("$tmp")
debug "Temporary output path:" "$tmp"