Watch more file events for CRL files

This commit is contained in:
Jan Dittberner 2022-10-08 13:41:00 +02:00
parent 01c2da507f
commit ffffe3c329

View file

@ -122,14 +122,21 @@ func (d *CRLCertDB) LookupResponseTemplate(number *big.Int) *ocsp.Response {
} }
func (d *CRLCertDB) watchCRLFile(watcher *fsnotify.Watcher) { func (d *CRLCertDB) watchCRLFile(watcher *fsnotify.Watcher) {
const eventMask = fsnotify.Create | fsnotify.Write | fsnotify.Chmod | fsnotify.Rename
for { for {
select { select {
case event, ok := <-watcher.Events: case event, ok := <-watcher.Events:
if !ok { if !ok {
logrus.Trace("could not read file watcher event")
return 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 { if event.Name == d.crlPath {
logrus.Infof("modified: %s", event.Name) logrus.Infof("modified: %s", event.Name)