mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-10-08 22:46:41 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user