Blame SOURCES/fapolicyd-markfs-3.patch

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