diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/dump.go | 8 | ||||
-rw-r--r-- | cmd/serve.go | 4 | ||||
-rw-r--r-- | cmd/web.go | 5 |
3 files changed, 11 insertions, 6 deletions
diff --git a/cmd/dump.go b/cmd/dump.go index 027f251a0c..d17b5e2fb0 100644 --- a/cmd/dump.go +++ b/cmd/dump.go @@ -79,7 +79,6 @@ func runDump(ctx *cli.Context) error { log.Printf("Packing dump files...") z, err := zip.Create(fileName) if err != nil { - os.Remove(fileName) log.Fatalf("Fail to create %s: %v", fileName, err) } @@ -102,7 +101,7 @@ func runDump(ctx *cli.Context) error { } // FIXME: SSH key file. if err = z.Close(); err != nil { - os.Remove(fileName) + _ = os.Remove(fileName) log.Fatalf("Fail to save %s: %v", fileName, err) } @@ -111,7 +110,10 @@ func runDump(ctx *cli.Context) error { } log.Printf("Removing tmp work dir: %s", TmpWorkDir) - os.RemoveAll(TmpWorkDir) + + if err := os.RemoveAll(TmpWorkDir); err != nil { + log.Fatalf("Fail to remove %s: %v", TmpWorkDir, err) + } log.Printf("Finish dumping in file %s", fileName) return nil diff --git a/cmd/serve.go b/cmd/serve.go index 2578b26dfd..3ac29d7ec3 100644 --- a/cmd/serve.go +++ b/cmd/serve.go @@ -51,7 +51,9 @@ func setup(logPath string) { if setting.UseSQLite3 || setting.UseTiDB { workDir, _ := setting.WorkDir() - os.Chdir(workDir) + if err := os.Chdir(workDir); err != nil { + log.GitLogger.Fatal(4, "Fail to change directory %s: %v", workDir, err) + } } models.SetEngine() diff --git a/cmd/web.go b/cmd/web.go index c53f518af4..5442850561 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -654,8 +654,9 @@ func runWeb(ctx *cli.Context) error { case setting.FCGI: err = fcgi.Serve(nil, m) case setting.UnixSocket: - os.Remove(listenAddr) - + if err := os.Remove(listenAddr); err != nil { + log.Fatal(4, "Fail to remove unix socket directory %s: %v", listenAddr, err) + } var listener *net.UnixListener listener, err = net.ListenUnix("unix", &net.UnixAddr{Name: listenAddr, Net: "unix"}) if err != nil { |