mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-16 05:47:06 +09:00
backup: Lock the buffer lines in Backup()
This commit is contained in:
@@ -82,6 +82,9 @@ func (b *Buffer) Backup() error {
|
|||||||
name := filepath.Join(backupdir, util.EscapePath(b.AbsPath))
|
name := filepath.Join(backupdir, util.EscapePath(b.AbsPath))
|
||||||
|
|
||||||
err = overwriteFile(name, encoding.Nop, func(file io.Writer) (e error) {
|
err = overwriteFile(name, encoding.Nop, func(file io.Writer) (e error) {
|
||||||
|
b.Lock()
|
||||||
|
defer b.Unlock()
|
||||||
|
|
||||||
if len(b.lines) == 0 {
|
if len(b.lines) == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user