From 714a47ffb09a1c5ea257f3225643efe58a670b7e Mon Sep 17 00:00:00 2001 From: Simon Frei Date: Fri, 5 Oct 2018 08:21:39 +0200 Subject: [PATCH] lib/config: Add context to the home disk out of space error (#5241) --- lib/config/wrapper.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/config/wrapper.go b/lib/config/wrapper.go index 1f19fce4..543464af 100644 --- a/lib/config/wrapper.go +++ b/lib/config/wrapper.go @@ -7,6 +7,7 @@ package config import ( + "fmt" "os" "path/filepath" "sync/atomic" @@ -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 }