aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugin/hosts/hostsfile.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/plugin/hosts/hostsfile.go b/plugin/hosts/hostsfile.go
index 924c827da..cf3c43cc8 100644
--- a/plugin/hosts/hostsfile.go
+++ b/plugin/hosts/hostsfile.go
@@ -117,11 +117,14 @@ func (h *Hostsfile) readHosts() {
defer file.Close()
stat, err := file.Stat()
+ if err != nil {
+ return
+ }
h.RLock()
size := h.size
h.RUnlock()
- if err == nil && h.mtime.Equal(stat.ModTime()) && size == stat.Size() {
+ if h.mtime.Equal(stat.ModTime()) && size == stat.Size() {
return
}