kept second-drive copies (D25: R-1175, R-1181, R-1179); .fab import keeps the family gate (R-1191); stale restore temp (R-1188 c); the overcommit sentence made true (R-1192); escrow before the floor (R-1176); unreleased
gates / gates (push) Successful in 1m20s
gates / gates (push) Successful in 1m20s
This commit is contained in:
@@ -84,6 +84,14 @@ func copyFilePreserving(src, dst string, fi fs.FileInfo) error {
|
||||
}
|
||||
defer in.Close()
|
||||
tmp := dst + ".felhom-restoring"
|
||||
// R-1188 (c): an interrupted earlier restore (a power cut mid-copy) leaves this exact temp behind, and O_EXCL then
|
||||
// failed EVERY retry with „file exists" — the file never came back. The temp is ours by name; a leftover REGULAR
|
||||
// file of that one name is removed before the copy. Anything else at that name (a directory, a link) still refuses.
|
||||
if st, lerr := os.Lstat(tmp); lerr == nil && st.Mode().IsRegular() {
|
||||
if rerr := os.Remove(tmp); rerr != nil {
|
||||
return fmt.Errorf("leftover %s from an interrupted restore could not be removed: %w", filepath.Base(tmp), rerr)
|
||||
}
|
||||
}
|
||||
out, err := os.OpenFile(tmp, os.O_WRONLY|os.O_CREATE|os.O_EXCL, fi.Mode().Perm())
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user