backup: Perform write process safe

This commit is contained in:
Jöran Karl
2024-05-31 20:44:38 +02:00
parent 21b7080935
commit 4ac8c786f5
2 changed files with 23 additions and 35 deletions

View File

@@ -103,6 +103,9 @@ func (b *Buffer) overwrite(name string, withSudo bool) (int, error) {
var size int
fwriter := func(file io.Writer) error {
b.Lock()
defer b.Unlock()
if len(b.lines) == 0 {
return err
}