Blame SOURCES/fapolicyd-markfs-3.patch

6db311
From cd315ebb45e3a095f612ec0e03f606a5383c39ba Mon Sep 17 00:00:00 2001
6db311
From: Steve Grubb <sgrubb@redhat.com>
6db311
Date: Wed, 28 Sep 2022 16:36:28 -0400
6db311
Subject: [PATCH] Add a check to see if they are defined before using them
6db311
6db311
---
6db311
 src/daemon/notify.c         |  2 +-
6db311
 src/library/daemon-config.c | 14 ++++++++------
6db311
 2 files changed, 9 insertions(+), 7 deletions(-)
6db311
6db311
diff --git a/src/daemon/notify.c b/src/daemon/notify.c
6db311
index f36b644..3986390 100644
6db311
--- a/src/daemon/notify.c
6db311
+++ b/src/daemon/notify.c
6db311
@@ -124,7 +124,7 @@ int init_fanotify(const conf_t *conf, mlist *m)
6db311
 	while (path) {
6db311
 retry_mark:
6db311
 		unsigned int flags = FAN_MARK_ADD;
6db311
-#if HAVE_DECL_FAN_MARK_FILESYSTEM != 0
6db311
+#if defined HAVE_DECL_FAN_MARK_FILESYSTEM && HAVE_DECL_FAN_MARK_FILESYSTEM != 0
6db311
 		if (conf->allow_filesystem_mark)
6db311
 		    flags |= FAN_MARK_FILESYSTEM;
6db311
 #else
6db311
diff --git a/src/library/daemon-config.c b/src/library/daemon-config.c
6db311
index 778b89a..ba8ade0 100644
6db311
--- a/src/library/daemon-config.c
6db311
+++ b/src/library/daemon-config.c
6db311
@@ -618,17 +618,19 @@ static int fs_mark_parser(const struct nv_pair *nv, int line,
6db311
 		conf_t *config)
6db311
 {
6db311
 	int rc = 0;
6db311
-#if HAVE_DECL_FAN_MARK_FILESYSTEM == 0
6db311
-	msg(LOG_WARNING,
6db311
-	    "allow_filesystem_mark is unsupported on this kernel - ignoring");
6db311
-#else
6db311
-	rc = unsigned_int_parser(&(config->allow_filesystem_mark), nv->value, line);
6db311
+#if defined HAVE_DECL_FAN_MARK_FILESYSTEM && HAVE_DECL_FAN_MARK_FILESYSTEM != 0
6db311
+	rc = unsigned_int_parser(&(config->allow_filesystem_mark),
6db311
+				 nv->value, line);
6db311
 
6db311
 	if (rc == 0 && config->allow_filesystem_mark > 1) {
6db311
 		msg(LOG_WARNING,
6db311
-			"allow_filesystem_mark value reset to 0 - line %d", line);
6db311
+			"allow_filesystem_mark value reset to 0 - line %d",
6db311
+			line);
6db311
 		config->allow_filesystem_mark = 0;
6db311
 	}
6db311
+#else
6db311
+	msg(LOG_WARNING,
6db311
+	    "allow_filesystem_mark is unsupported on this kernel - ignoring");
6db311
 #endif
6db311
 
6db311
 	return rc;