From f334120c91a857f6200c4028cbb7bad2d2162792 Mon Sep 17 00:00:00 2001 From: starlet-dx <15929766099@163.com> Date: Wed, 9 Nov 2022 18:32:54 +0800 Subject: [PATCH 1/1] Fix build error --- src/daemon/notify.c | 5 +++-- src/library/daemon-config.c | 14 ++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/daemon/notify.c b/src/daemon/notify.c index c91abc4..586b6df 100644 --- a/src/daemon/notify.c +++ b/src/daemon/notify.c @@ -122,9 +122,10 @@ int init_fanotify(const conf_t *conf, mlist *m) // Iterate through the mount points and add a mark path = mlist_first(m); while (path) { + unsigned int flags; retry_mark: - unsigned int flags = FAN_MARK_ADD; -#ifdef HAVE_DECL_FAN_MARK_FILESYSTEM + flags = FAN_MARK_ADD; +#if defined HAVE_DECL_FAN_MARK_FILESYSTEM && HAVE_DECL_FAN_MARK_FILESYSTEM != 0 if (conf->allow_filesystem_mark) flags |= FAN_MARK_FILESYSTEM; #else diff --git a/src/library/daemon-config.c b/src/library/daemon-config.c index 89b7f68..ba8ade0 100644 --- a/src/library/daemon-config.c +++ b/src/library/daemon-config.c @@ -618,17 +618,19 @@ static int fs_mark_parser(const struct nv_pair *nv, int line, conf_t *config) { int rc = 0; -#ifndef HAVE_DECL_FAN_MARK_FILESYSTEM - msg(LOG_WARNING, - "allow_filesystem_mark is unsupported on this kernel - ignoring"); -#else - rc = unsigned_int_parser(&(config->allow_filesystem_mark), nv->value, line); +#if defined HAVE_DECL_FAN_MARK_FILESYSTEM && HAVE_DECL_FAN_MARK_FILESYSTEM != 0 + rc = unsigned_int_parser(&(config->allow_filesystem_mark), + nv->value, line); if (rc == 0 && config->allow_filesystem_mark > 1) { msg(LOG_WARNING, - "allow_filesystem_mark value reset to 0 - line %d", line); + "allow_filesystem_mark value reset to 0 - line %d", + line); config->allow_filesystem_mark = 0; } +#else + msg(LOG_WARNING, + "allow_filesystem_mark is unsupported on this kernel - ignoring"); #endif return rc; -- 2.30.0