From 9ff04ee3d866b1f8a74444ae1e4bb910487fdb29 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Wed, 10 Sep 2014 10:36:05 +0200 Subject: [PATCH] Don't start when the config dir is not a dir --- cmd/syncthing/main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/syncthing/main.go b/cmd/syncthing/main.go index eff5536f5..dd162a388 100644 --- a/cmd/syncthing/main.go +++ b/cmd/syncthing/main.go @@ -248,6 +248,12 @@ func main() { return } + confDir = expandTilde(confDir) + + if info, err := os.Stat(confDir); err == nil && !info.IsDir() { + l.Fatalln("Config directory", confDir, "is not a directory") + } + if os.Getenv("STNORESTART") != "" { syncthingMain() } else { @@ -266,8 +272,6 @@ func syncthingMain() { runtime.GOMAXPROCS(runtime.NumCPU()) } - confDir = expandTilde(confDir) - events.Default.Log(events.Starting, map[string]string{"home": confDir}) if _, err = os.Stat(confDir); err != nil && confDir == getDefaultConfDir() {