Jelajahi Sumber

notifyd: Propagate error to exit code

When it's impossible to dispatch cmap/quorum messages exit code of
corosync-notifyd shouldn't be success.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
(cherry picked from commit e313bbf8cb06992116d6dd051ba378e9eca64dbf)
Jan Friesse 7 tahun lalu
induk
melakukan
ab65435641
1 mengubah file dengan 7 tambahan dan 1 penghapusan
  1. 7 1
      tools/corosync-notifyd.c

+ 7 - 1
tools/corosync-notifyd.c

@@ -72,6 +72,8 @@ enum {
 };
 static int conf[CS_NTF_MAX];
 
+static int exit_code = 0;
+
 static int32_t _cs_is_quorate = 0;
 
 typedef void (*node_membership_fn_t)(char *nodename, uint32_t nodeid, char *state, char* ip);
@@ -357,6 +359,8 @@ _cs_cmap_dispatch(int fd, int revents, void *data)
 		qb_log(LOG_ERR, "Could not dispatch cmap events. Error %u", err);
 		qb_loop_stop(main_loop);
 
+		exit_code = 1;
+
 		return -1;
 	}
 
@@ -390,6 +394,8 @@ _cs_quorum_dispatch(int fd, int revents, void *data)
 		qb_log(LOG_ERR, "Could not dispatch quorum events. Error %u", err);
 		qb_loop_stop(main_loop);
 
+		exit_code = 1;
+
 		return -1;
 	}
 	return 0;
@@ -1251,6 +1257,6 @@ main(int argc, char *argv[])
 	_cs_quorum_finalize();
 	_cs_cmap_finalize();
 
-	return 0;
+	return (exit_code);
 }