pidfile: monitor renamed files, e.g. rsyslogd.pid.tmp

Signed-off-by: Robert Andersson <robert.m.andersson@se.atlascopco.com>
This commit is contained in:
Robert Andersson
2018-10-22 12:53:57 +02:00
parent b64dbbf8d0
commit 76fc72770e
+3 -2
View File
@@ -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) {