fapolicyd/SOURCES/fapolicyd-markfs-3.patch

54 lines
1.8 KiB
Diff

From cd315ebb45e3a095f612ec0e03f606a5383c39ba Mon Sep 17 00:00:00 2001
From: Steve Grubb <sgrubb@redhat.com>
Date: Wed, 28 Sep 2022 16:36:28 -0400
Subject: [PATCH] Add a check to see if they are defined before using them
---
src/daemon/notify.c | 2 +-
src/library/daemon-config.c | 14 ++++++++------
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/daemon/notify.c b/src/daemon/notify.c
index f36b644..3986390 100644
--- a/src/daemon/notify.c
+++ b/src/daemon/notify.c
@@ -124,7 +124,7 @@ int init_fanotify(const conf_t *conf, mlist *m)
while (path) {
retry_mark:
unsigned int flags = FAN_MARK_ADD;
-#if HAVE_DECL_FAN_MARK_FILESYSTEM != 0
+#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 778b89a..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;
-#if HAVE_DECL_FAN_MARK_FILESYSTEM == 0
- 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;