From ffffe3c3293fd3e61f2381acff5488da87d2abc9 Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Sat, 8 Oct 2022 13:41:00 +0200 Subject: [PATCH] Watch more file events for CRL files --- pkg/crlcertdb/crlcertdb.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/crlcertdb/crlcertdb.go b/pkg/crlcertdb/crlcertdb.go index d22d0a2..626cde0 100644 --- a/pkg/crlcertdb/crlcertdb.go +++ b/pkg/crlcertdb/crlcertdb.go @@ -122,14 +122,21 @@ func (d *CRLCertDB) LookupResponseTemplate(number *big.Int) *ocsp.Response { } func (d *CRLCertDB) watchCRLFile(watcher *fsnotify.Watcher) { + const eventMask = fsnotify.Create | fsnotify.Write | fsnotify.Chmod | fsnotify.Rename + for { select { case event, ok := <-watcher.Events: if !ok { + logrus.Trace("could not read file watcher event") return } - if event.Op&fsnotify.Write == fsnotify.Write { + logrus.Tracef("received event %s", event) + + if event.Op&eventMask >= 1 { + logrus.Tracef("event matches event mask %s", event) + if event.Name == d.crlPath { logrus.Infof("modified: %s", event.Name)