diff options
| author | Dennis Fink | 2026-02-24 21:16:50 +0100 |
|---|---|---|
| committer | Dennis Fink | 2026-02-24 21:16:50 +0100 |
| commit | 1176ccc0345e6c04b9eae9cdf71851fe05204f32 (patch) | |
| tree | 7915062cb4335ff3e501354408ca64a3cd894c06 | |
| parent | c9f7b81f013eca9d25d956f1f644c05ec9814ae0 (diff) | |
| download | transcode.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-x | transcode.sh | 4 |
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" |
