fix(journal): fail write/append when the temp copy can't be written

pmx_write_file and pmx_append_file didn't check the first cat into
the temp file, so a full /tmp returned 0 and left a truncated target.
This commit is contained in:
pbr
2026-10-01 21:43:40 +02:00
parent 37a461c5e5
commit e5fc9c7188
+2 -2
View File
@@ -160,7 +160,7 @@ pmx_write_file() {
local path="$1"
local temp before="" after="" existed="false"
temp="$(mktemp)" || { cat > "$path"; return $?; }
cat > "$temp"
cat > "$temp" || { rm -f "$temp"; return 1; }
local kept="true"
if [ -f "$path" ]; then
@@ -247,7 +247,7 @@ pmx_append_file() {
local path="$1"
local temp before="" after="" existed="false"
temp="$(mktemp)" || { cat >> "$path"; return $?; }
cat > "$temp"
cat > "$temp" || { rm -f "$temp"; return 1; }
local kept="true"
if [ -f "$path" ]; then