Skip to content

Commit

Permalink
cmd/serv: actually exit after fatal errors (go-gitea#7458)
Browse files Browse the repository at this point in the history
Regression in 356854f, where
a log.Fatal call was removed. log.Fatal calls os.Exit(1) as intended,
but without it the fail() function returns normally and execution
continues past the fatal error, causing a panic.

This is visible as a go panic log and stack trace returned to the SSH
client, which is not only ugly, it leaks server and build system
information.

Fix by removing the stray return statement so that the fail() function
always calls os.Exit(1).

Fixes: go-gitea#7457
Signed-off-by: Allen Wild <[email protected]>
  • Loading branch information
aswild authored and jeffliu27 committed Jul 18, 2019
1 parent 3733690 commit 5bd2e10
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion cmd/serv.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ func fail(userMessage, logMessage string, args ...interface{}) {
if !setting.ProdMode {
fmt.Fprintf(os.Stderr, logMessage+"\n", args...)
}
return
}

os.Exit(1)
Expand Down

0 comments on commit 5bd2e10

Please sign in to comment.