summaryrefslogtreecommitdiff
path: root/admin.go
diff options
context:
space:
mode:
Diffstat (limited to 'admin.go')
-rw-r--r--admin.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/admin.go b/admin.go
index 8ac12fd..f539b44 100644
--- a/admin.go
+++ b/admin.go
@@ -398,7 +398,10 @@ func (h adminHandler) handleError(w http.ResponseWriter, r *http.Request, err er
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(apiErr.Code)
- json.NewEncoder(w).Encode(apiErr)
+ encErr := json.NewEncoder(w).Encode(apiErr)
+ if encErr != nil {
+ Log().Named("admin.api").Error("failed to encode error response", zap.Error(encErr))
+ }
}
// checkHost returns a handler that wraps next such that
@@ -838,7 +841,7 @@ var (
// will get deleted before the process gracefully exits.
func PIDFile(filename string) error {
pid := []byte(strconv.Itoa(os.Getpid()) + "\n")
- err := ioutil.WriteFile(filename, pid, 0644)
+ err := ioutil.WriteFile(filename, pid, 0600)
if err != nil {
return err
}