mirror of https://github.com/digint/btrbk
btrbk: append to info file instead of rewriting
A redirection (e.g. `echo foo > bar.info`) can cause empty (zero-size)
files in some circumstances.
We still write INCOMPLETE=1 to the info file before send/receive, but
instead of re-creating it without the INCOMPLETE flag, we append
INCOMPLETE=0 (keeping up compatibility with old versions of btrbk).
Ref: 4e5ae975d8
btrbk: ignore zero-size info files
ionice
parent
51b2a5a9f5
commit
dcee6222be
2
btrbk
2
btrbk
|
@ -1857,7 +1857,7 @@ sub btrfs_send_to_file($$$;$$)
|
||||||
);
|
);
|
||||||
if(defined($ret)) {
|
if(defined($ret)) {
|
||||||
delete $raw_info{INCOMPLETE};
|
delete $raw_info{INCOMPLETE};
|
||||||
$ret = system_write_raw_info($vol_received, \%raw_info);
|
$ret = system_write_raw_info($vol_received, { INCOMPLETE => 0 }, append => 1);
|
||||||
} else {
|
} else {
|
||||||
push @cmd_err, "failed to check target file (not present or zero length): $check_file";
|
push @cmd_err, "failed to check target file (not present or zero length): $check_file";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue