Skip to content

Commit

Permalink
lib/config: Add context to the home disk out of space error (syncthin…
Browse files Browse the repository at this point in the history
  • Loading branch information
imsodin authored and calmh committed Oct 5, 2018
1 parent 86a22b8 commit 714a47f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/config/wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package config

import (
"fmt"
"os"
"path/filepath"
"sync/atomic"
Expand Down Expand Up @@ -499,8 +500,11 @@ func (w *Wrapper) AddOrUpdatePendingFolder(id, label string, device protocol.Dev
// CheckHomeFreeSpace returns nil if the home disk has the required amount of
// free space, or if home disk free space checking is disabled.
func (w *Wrapper) CheckHomeFreeSpace() error {
if usage, err := fs.NewFilesystem(fs.FilesystemTypeBasic, filepath.Dir(w.ConfigPath())).Usage("."); err == nil {
return checkFreeSpace(w.Options().MinHomeDiskFree, usage)
path := filepath.Dir(w.ConfigPath())
if usage, err := fs.NewFilesystem(fs.FilesystemTypeBasic, path).Usage("."); err == nil {
if err = checkFreeSpace(w.Options().MinHomeDiskFree, usage); err != nil {
return fmt.Errorf("insufficient space on home disk (%v): %v", path, err)
}
}
return nil
}

0 comments on commit 714a47f

Please sign in to comment.