Blob Blame History Raw
From d12dde7f3fdeb82a9fb064e26d260f40fb2036c0 Mon Sep 17 00:00:00 2001
From: Steve Grubb <sgrubb@redhat.com>
Date: Mon, 22 Mar 2021 10:38:31 -0400
Subject: [PATCH] Do not exit on fanotify_event read failure

---
 ChangeLog           |  1 +
 src/daemon/notify.c | 11 ++++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/daemon/notify.c b/src/daemon/notify.c
index 3e42b92..a83db39 100644
--- a/src/daemon/notify.c
+++ b/src/daemon/notify.c
@@ -337,8 +337,13 @@ void handle_events(void)
 			len = read(fd, (void *) buf, sizeof(buf));
 		} while (len == -1 && errno == EINTR && stop == 0);
 		if (len == -1 && errno != EAGAIN) {
-			msg(LOG_ERR,"Error reading (%s)", strerror(errno));
-			exit(1);
+			// If we get this, we have no access to the file. We
+			// cannot formulate a reply either to deny it because
+			// we have nothing to work with.
+			msg(LOG_ERR,
+			    "Error receiving fanotify_event (%s)",
+			    strerror(errno));
+			return;
 		}
 		if (stop)
 			return;