From 94c746c44f9fbd1330f123204ba2a0dbd63ce366 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Thu, 12 Nov 2015 23:54:57 -0700 Subject: [PATCH] letsencrypt: Return an error if making site folder fails --- caddy/letsencrypt/letsencrypt.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/caddy/letsencrypt/letsencrypt.go b/caddy/letsencrypt/letsencrypt.go index c5c4df6d..7de0ac8d 100644 --- a/caddy/letsencrypt/letsencrypt.go +++ b/caddy/letsencrypt/letsencrypt.go @@ -287,10 +287,13 @@ func obtainCertificates(client *acme.Client, serverConfigs []server.Config) ([]a // metadata file. func saveCertsAndKeys(certificates []acme.CertificateResource) error { for _, cert := range certificates { - os.MkdirAll(storage.Site(cert.Domain), 0700) + err := os.MkdirAll(storage.Site(cert.Domain), 0700) + if err != nil { + return err + } // Save cert - err := ioutil.WriteFile(storage.SiteCertFile(cert.Domain), cert.Certificate, 0600) + err = ioutil.WriteFile(storage.SiteCertFile(cert.Domain), cert.Certificate, 0600) if err != nil { return err }