From 76fc72770e93b21dbe23773788ef9e2456522062 Mon Sep 17 00:00:00 2001 From: Robert Andersson Date: Mon, 3 Sep 2018 10:17:21 +0200 Subject: [PATCH] pidfile: monitor renamed files, e.g. rsyslogd.pid.tmp Signed-off-by: Robert Andersson --- plugins/pidfile.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/pidfile.c b/plugins/pidfile.c index 8c8f74e4..34140ec1 100644 --- a/plugins/pidfile.c +++ b/plugins/pidfile.c @@ -64,7 +64,7 @@ static void pidfile_callback(void *arg, int fd, int events) continue; mkcond(cond, sizeof(cond), svc->cmd); - if (ev->mask & (IN_CREATE | IN_ATTRIB | IN_MODIFY)) { + if (ev->mask & (IN_CREATE | IN_ATTRIB | IN_MODIFY | IN_MOVED_TO)) { svc_started(svc); cond_set(cond); } else if (ev->mask & IN_DELETE) @@ -111,6 +111,7 @@ static void pidfile_init(void *arg) { char *path; struct context *ctx = arg; + uint32_t mask = IN_CREATE | IN_ATTRIB | IN_DELETE | IN_MODIFY | IN_MOVED_TO; /* * The bootmisc plugin is responsible for setting up /var/run. @@ -123,7 +124,7 @@ static void pidfile_init(void *arg) return; } - ctx->wd = inotify_add_watch(ctx->fd, path, IN_CREATE | IN_ATTRIB | IN_DELETE | IN_MODIFY); + ctx->wd = inotify_add_watch(ctx->fd, path, mask); free(path); if (ctx->wd < 0) {