From 29b707b2a7a8d98cc956d1fae582f117702ddeaf Mon Sep 17 00:00:00 2001 From: bizhiyuan Date: Fri, 9 Aug 2024 15:32:56 +0800 Subject: [PATCH] Refactor fix problems found by clang and refactor foreach (cherry picked from commit dd3b0becad0ab888adfeddfb326e978301c0f862) --- backport-Fix-typo-in-wait_child.patch | 29 +++ ...Refactor-Fix-problems-found-by-clang.patch | 130 ++++++++++ ..._-node-ticket-apply-more-universally.patch | 208 +++++++++++++++ ...foreach_-node-ticket-macros-to-upper.patch | 241 ++++++++++++++++++ booth.spec | 12 +- 5 files changed, 619 insertions(+), 1 deletion(-) create mode 100644 backport-Fix-typo-in-wait_child.patch create mode 100644 backport-Refactor-Fix-problems-found-by-clang.patch create mode 100644 backport-Refactor-foreach_-node-ticket-apply-more-universally.patch create mode 100644 backport-Refactor-rename-foreach_-node-ticket-macros-to-upper.patch diff --git a/backport-Fix-typo-in-wait_child.patch b/backport-Fix-typo-in-wait_child.patch new file mode 100644 index 0000000..0897ab6 --- /dev/null +++ b/backport-Fix-typo-in-wait_child.patch @@ -0,0 +1,29 @@ +From 488dcccef833f189245e139306a135feaac8d3ed Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= +Date: Tue, 28 Jan 2020 17:10:30 +0100 +Subject: [PATCH 11/20] Fix typo in wait_child +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Jan Pokorný +--- + src/handler.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/handler.c b/src/handler.c +index a12857e..c7d6995 100644 +--- a/src/handler.c ++++ b/src/handler.c +@@ -130,7 +130,7 @@ void wait_child(int sig) + int i, status; + struct ticket_config *tk; + +- /* use waitpid(2) and not wait(2) in order not to interfear ++ /* use waitpid(2) and not wait(2) in order not to interfere + * with popen(2)/pclose(2) and system(2) used in pacemaker.c + */ + foreach_ticket(i, tk) { +-- +2.25.1 + diff --git a/backport-Refactor-Fix-problems-found-by-clang.patch b/backport-Refactor-Fix-problems-found-by-clang.patch new file mode 100644 index 0000000..97507a1 --- /dev/null +++ b/backport-Refactor-Fix-problems-found-by-clang.patch @@ -0,0 +1,130 @@ +From f31d896ba5f72853aed8191dbb99f9c670fcb866 Mon Sep 17 00:00:00 2001 +From: Chris Lumens +Date: Wed, 26 Jun 2024 14:43:56 -0400 +Subject: [PATCH 14/20] Refactor: Fix problems found by clang. + +* Several strings are initialized to some value, immediately followed by + a block of code that sets them to some other value. The original + initialization can go away. + +* Warn if vsnprintf fails. + +* Get rid of setting a couple return values that are never checked. + +* In read_client, set msg to 0 if we malloc'd it so that header->length + is an initialized value when we access it later on. + +* In _find_myself, check that tb[IFA_ADDRESS] is not NULL before + accessing it. I'm not sure what we can do if both this and + tb[IFA_LOCAL] are NULL aside from log and return. +--- + src/alt/nametag_libsystemd.c | 4 ++++ + src/attr.c | 2 +- + src/main.c | 3 +-- + src/ticket.c | 2 +- + src/transport.c | 11 ++++++++--- + 5 files changed, 15 insertions(+), 7 deletions(-) + +diff --git a/src/alt/nametag_libsystemd.c b/src/alt/nametag_libsystemd.c +index 26e5009..114b0e4 100644 +--- a/src/alt/nametag_libsystemd.c ++++ b/src/alt/nametag_libsystemd.c +@@ -73,6 +73,10 @@ void sd_notify_wrapper(const char *fmt, ...) + rv = vsnprintf(buffer, sizeof(buffer), suffix, ap); + va_end(ap); + ++ if (rv < 0) { ++ log_warn("%s:%d: vsnprintf fail", __FILE__, __LINE__); ++ } ++ + rv = sd_notifyf(0, "READY=1\n" + "STATUS=Running: %s", + buffer); +diff --git a/src/attr.c b/src/attr.c +index bc154f0..daa7648 100644 +--- a/src/attr.c ++++ b/src/attr.c +@@ -65,7 +65,7 @@ void print_geostore_usage(void) + int test_attr_reply(cmd_result_t reply_code, cmd_request_t cmd) + { + int rv = 0; +- const char *op_str = ""; ++ const char *op_str = NULL; + + switch (cmd) { + case ATTR_SET: op_str = "set"; break; +diff --git a/src/main.c b/src/main.c +index 71932fa..6efd569 100644 +--- a/src/main.c ++++ b/src/main.c +@@ -584,7 +584,7 @@ fail: + static int test_reply(cmd_result_t reply_code, cmd_request_t cmd) + { + int rv = 0; +- const char *op_str = ""; ++ const char *op_str = NULL; + + if (cmd == CMD_GRANT) + op_str = "grant"; +@@ -743,7 +743,6 @@ static int query_get_string_answer(cmd_request_t cmd) + *(data + data_len) = '\0'; + (void)fputs(data, stdout); + fflush(stdout); +- rv = 0; + + out_test_reply: + rv = test_reply_f(ntohl(reply.header.result), cmd); +diff --git a/src/ticket.c b/src/ticket.c +index 622a9d1..67c7cd0 100644 +--- a/src/ticket.c ++++ b/src/ticket.c +@@ -544,7 +544,7 @@ void reset_ticket_and_set_no_leader(struct ticket_config *tk) + static void log_reacquire_reason(struct ticket_config *tk) + { + int valid; +- const char *where_granted = "\0"; ++ const char *where_granted = NULL; + char buff[75]; + + valid = is_time_set(&tk->term_expires) && !is_past(&tk->term_expires); +diff --git a/src/transport.c b/src/transport.c +index 8267c96..40a46d2 100644 +--- a/src/transport.c ++++ b/src/transport.c +@@ -232,9 +232,13 @@ int _find_myself(int family, struct booth_site **mep, int fuzzy_allowed) + if (tb[IFA_LOCAL]) { + memcpy(ipaddr, RTA_DATA(tb[IFA_LOCAL]), + BOOTH_IPADDR_LEN); +- } else { ++ } else if (tb[IFA_ADDRESS]) { + memcpy(ipaddr, RTA_DATA(tb[IFA_ADDRESS]), + BOOTH_IPADDR_LEN); ++ } else { ++ log_error("failed to copy netlink addr"); ++ close(fd); ++ return 0; + } + + /* Try to find the exact address or the address with subnet matching. +@@ -387,6 +391,8 @@ int read_client(struct client *req_cl) + log_error("out of memory for client messages"); + return -1; + } ++ ++ memset(msg, 0, MAX_MSG_LEN); + req_cl->msg = (void *)msg; + } else { + msg = (char *)req_cl->msg; +@@ -616,8 +622,7 @@ static int connect_nonb(int sockfd, const struct sockaddr *saptr, + tval.tv_sec = sec; + tval.tv_usec = 0; + +- if ((n = select(sockfd + 1, &rset, &wset, NULL, +- sec ? &tval : NULL)) == 0) { ++ if (select(sockfd + 1, &rset, &wset, NULL, sec ? &tval : NULL) == 0) { + /* leave outside function to close */ + /* timeout */ + /* close(sockfd); */ +-- +2.25.1 + diff --git a/backport-Refactor-foreach_-node-ticket-apply-more-universally.patch b/backport-Refactor-foreach_-node-ticket-apply-more-universally.patch new file mode 100644 index 0000000..b11c41b --- /dev/null +++ b/backport-Refactor-foreach_-node-ticket-apply-more-universally.patch @@ -0,0 +1,208 @@ +From 911f1fdfc2f1985088e364323f46b0085df1cf9c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= +Date: Tue, 21 Jan 2020 17:23:08 +0100 +Subject: [PATCH 12/20] Refactor: foreach_{node,ticket}: apply more universally +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This is a primitive that's easier to follow/more terse. +Looking forward, we skip some places where we want to introduce +a refactoring to drop an undesired non-transparent reliance on +booth_conf global variable prior to modifying these two macros +to that effect as well (respective places, at least, receive +white-space-around-operators sanitization). + +Signed-off-by: Jan Pokorný +--- + src/config.c | 9 +++------ + src/raft.c | 7 +++---- + src/ticket.c | 22 +++++++++++----------- + src/ticket.h | 11 +++++++++-- + src/transport.c | 3 +-- + 5 files changed, 27 insertions(+), 25 deletions(-) + +diff --git a/src/config.c b/src/config.c +index a533da3..cc338f9 100644 +--- a/src/config.c ++++ b/src/config.c +@@ -986,8 +986,7 @@ static int get_other_site(struct booth_site **node) + if (!booth_conf) + return 0; + +- for (i = 0; i < booth_conf->site_count; i++) { +- n = booth_conf->site + i; ++ foreach_node(i, n) { + if (n != local && n->type == SITE) { + if (!*node) { + *node = n; +@@ -1012,8 +1011,7 @@ int find_site_by_name(char *site, struct booth_site **node, int any_type) + if (!strcmp(site, OTHER_SITE)) + return get_other_site(node); + +- for (i = 0; i < booth_conf->site_count; i++) { +- n = booth_conf->site + i; ++ foreach_node(i, n) { + if ((n->type == SITE || any_type) && + strncmp(n->addr_string, site, sizeof(n->addr_string)) == 0) { + *node = n; +@@ -1037,8 +1035,7 @@ int find_site_by_id(uint32_t site_id, struct booth_site **node) + if (!booth_conf) + return 0; + +- for (i = 0; i < booth_conf->site_count; i++) { +- n = booth_conf->site + i; ++ foreach_node(i, n) { + if (n->site_id == site_id) { + *node = n; + return 1; +diff --git a/src/raft.c b/src/raft.c +index 462fc3b..4b484a9 100644 +--- a/src/raft.c ++++ b/src/raft.c +@@ -161,7 +161,7 @@ static int is_tie(struct ticket_config *tk) + int count[MAX_NODES] = { 0, }; + int max_votes = 0, max_cnt = 0; + +- for(i=0; isite_count; i++) { ++ for (i = 0; i < booth_conf->site_count; i++) { + v = tk->votes_for[i]; + if (!v) + continue; +@@ -169,7 +169,7 @@ static int is_tie(struct ticket_config *tk) + max_votes = max(max_votes, count[v->index]); + } + +- for(i=0; isite_count; i++) { ++ for (i = 0; i < booth_conf->site_count; i++) { + if (count[i] == max_votes) + max_cnt++; + } +@@ -183,8 +183,7 @@ static struct booth_site *majority_votes(struct ticket_config *tk) + struct booth_site *v; + int count[MAX_NODES] = { 0, }; + +- +- for(i=0; isite_count; i++) { ++ for (i = 0; i < booth_conf->site_count; i++) { + v = tk->votes_for[i]; + if (!v || v == no_leader) + continue; +diff --git a/src/ticket.c b/src/ticket.c +index 622a9d1..5f8ec4e 100644 +--- a/src/ticket.c ++++ b/src/ticket.c +@@ -59,16 +59,16 @@ int check_max_len_valid(const char *s, int max) + + int find_ticket_by_name(const char *ticket, struct ticket_config **found) + { ++ struct ticket_config *tk; + int i; + + if (found) + *found = NULL; + +- for (i = 0; i < booth_conf->ticket_count; i++) { +- if (!strncmp(booth_conf->ticket[i].name, ticket, +- sizeof(booth_conf->ticket[i].name))) { ++ foreach_ticket(i, tk) { ++ if (!strncmp(tk->name, ticket, sizeof(tk->name))) { + if (found) +- *found = booth_conf->ticket + i; ++ *found = tk; + return 1; + } + } +@@ -392,6 +392,7 @@ int do_revoke_ticket(struct ticket_config *tk) + int list_ticket(char **pdata, unsigned int *len) + { + struct ticket_config *tk; ++ struct booth_site *site; + char timeout_str[64]; + char pending_str[64]; + char *data, *cp; +@@ -476,12 +477,12 @@ int list_ticket(char **pdata, unsigned int *len) + "\nWARNING: The ticket %s is granted to multiple sites: ", // ~55 characters + tk->name); + +- for(site_index=0; site_indexsite_count; ++site_index) { ++ foreach_node(site_index, site) { + if (tk->sites_where_granted[site_index] > 0) { + cp += snprintf(cp, + alloc - (cp - data), + "%s", +- site_string(&(booth_conf->site[site_index]))); ++ site_string(site)); + + if (--multiple_grant_warning_length > 0) { + cp += snprintf(cp, +@@ -859,8 +860,7 @@ static void log_lost_servers(struct ticket_config *tk) + */ + return; + +- for (i = 0; i < booth_conf->site_count; i++) { +- n = booth_conf->site + i; ++ foreach_node(i, n) { + if (!(tk->acks_received & n->bitmask)) { + tk_log_warn("%s %s didn't acknowledge our %s, " + "will retry %d times", +@@ -880,8 +880,7 @@ static void resend_msg(struct ticket_config *tk) + if (!(tk->acks_received ^ local->bitmask)) { + ticket_broadcast(tk, tk->last_request, 0, RLT_SUCCESS, 0); + } else { +- for (i = 0; i < booth_conf->site_count; i++) { +- n = booth_conf->site + i; ++ foreach_node(i, n) { + if (!(tk->acks_received & n->bitmask)) { + n->resend_cnt++; + tk_log_debug("resending %s to %s", +@@ -1365,8 +1364,9 @@ int is_manual(struct ticket_config *tk) + int number_sites_marked_as_granted(struct ticket_config *tk) + { + int i, result = 0; ++ struct booth_site *ignored __attribute__((unused)); + +- for(i=0; isite_count; ++i) { ++ foreach_node(i, ignored) { + result += tk->sites_where_granted[i]; + } + +diff --git a/src/ticket.h b/src/ticket.h +index e36e323..59e84c0 100644 +--- a/src/ticket.h ++++ b/src/ticket.h +@@ -35,8 +35,15 @@ extern int TIME_RES; + #define DEFAULT_RETRIES 10 + + +-#define foreach_ticket(i_,t_) for(i_=0; (t_=booth_conf->ticket+i_, i_ticket_count); i_++) +-#define foreach_node(i_,n_) for(i_=0; (n_=booth_conf->site+i_, i_site_count); i_++) ++#define foreach_ticket(i_, t_) \ ++ for (i_ = 0; \ ++ (t_ = booth_conf->ticket + i_, i_ < booth_conf->ticket_count); \ ++ i_++) ++ ++#define foreach_node(i_, n_) \ ++ for (i_ = 0; \ ++ (n_ = booth_conf->site + i_, i_ < booth_conf->site_count); \ ++ i_++) + + #define set_leader(tk, who) do { \ + if (who == NULL) { \ +diff --git a/src/transport.c b/src/transport.c +index 8267c96..8e2d422 100644 +--- a/src/transport.c ++++ b/src/transport.c +@@ -98,8 +98,7 @@ static int find_address(unsigned char ipaddr[BOOTH_IPADDR_LEN], + /* One bit left to check means ignore 7 lowest bits. */ + mask = ~( (1 << (8 - bits_left)) -1); + +- for (i = 0; i < booth_conf->site_count; i++) { +- node = booth_conf->site + i; ++ foreach_node(i, node) { + if (family != node->family) + continue; + n_a = node_to_addr_pointer(node); +-- +2.25.1 + diff --git a/backport-Refactor-rename-foreach_-node-ticket-macros-to-upper.patch b/backport-Refactor-rename-foreach_-node-ticket-macros-to-upper.patch new file mode 100644 index 0000000..f69f99e --- /dev/null +++ b/backport-Refactor-rename-foreach_-node-ticket-macros-to-upper.patch @@ -0,0 +1,241 @@ +From de2b6a221793fcf69c43e71ba46f0576524d2537 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= +Date: Tue, 28 Jan 2020 21:38:21 +0100 +Subject: [PATCH 13/20] Refactor: rename foreach_{node,ticket} macros to + uppercased variants +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This is to allow for better visual identification of the macro magic. + +Signed-off-by: Jan Pokorný +--- + src/config.c | 6 +++--- + src/handler.c | 2 +- + src/main.c | 2 +- + src/raft.c | 3 ++- + src/ticket.c | 22 +++++++++++----------- + src/ticket.h | 4 ++-- + src/transport.c | 4 ++-- + 7 files changed, 22 insertions(+), 21 deletions(-) + +diff --git a/src/config.c b/src/config.c +index cc338f9..f1613eb 100644 +--- a/src/config.c ++++ b/src/config.c +@@ -986,7 +986,7 @@ static int get_other_site(struct booth_site **node) + if (!booth_conf) + return 0; + +- foreach_node(i, n) { ++ FOREACH_NODE(i, n) { + if (n != local && n->type == SITE) { + if (!*node) { + *node = n; +@@ -1011,7 +1011,7 @@ int find_site_by_name(char *site, struct booth_site **node, int any_type) + if (!strcmp(site, OTHER_SITE)) + return get_other_site(node); + +- foreach_node(i, n) { ++ FOREACH_NODE(i, n) { + if ((n->type == SITE || any_type) && + strncmp(n->addr_string, site, sizeof(n->addr_string)) == 0) { + *node = n; +@@ -1035,7 +1035,7 @@ int find_site_by_id(uint32_t site_id, struct booth_site **node) + if (!booth_conf) + return 0; + +- foreach_node(i, n) { ++ FOREACH_NODE(i, n) { + if (n->site_id == site_id) { + *node = n; + return 1; +diff --git a/src/handler.c b/src/handler.c +index c7d6995..9d74f0f 100644 +--- a/src/handler.c ++++ b/src/handler.c +@@ -133,7 +133,7 @@ void wait_child(int sig) + /* use waitpid(2) and not wait(2) in order not to interfere + * with popen(2)/pclose(2) and system(2) used in pacemaker.c + */ +- foreach_ticket(i, tk) { ++ FOREACH_TICKET(i, tk) { + if (tk_test.path && tk_test.pid > 0 && + (tk_test.progstate == EXTPROG_RUNNING || + tk_test.progstate == EXTPROG_IGNORE) && +diff --git a/src/main.c b/src/main.c +index 71932fa..2c96c68 100644 +--- a/src/main.c ++++ b/src/main.c +@@ -233,7 +233,7 @@ static int format_peers(char **pdata, unsigned int *len) + return -ENOMEM; + + cp = data; +- foreach_node(i, s) { ++ FOREACH_NODE(i, s) { + if (s == local) + continue; + strftime(time_str, sizeof(time_str), "%F %T", +diff --git a/src/raft.c b/src/raft.c +index 4b484a9..dbe773c 100644 +--- a/src/raft.c ++++ b/src/raft.c +@@ -40,8 +40,9 @@ inline static void clear_election(struct ticket_config *tk) + + tk_log_debug("clear election"); + tk->votes_received = 0; +- foreach_node(i, site) ++ FOREACH_NODE(i, site) { + tk->votes_for[site->index] = NULL; ++ } + } + + +diff --git a/src/ticket.c b/src/ticket.c +index 5f8ec4e..6673a2e 100644 +--- a/src/ticket.c ++++ b/src/ticket.c +@@ -65,7 +65,7 @@ int find_ticket_by_name(const char *ticket, struct ticket_config **found) + if (found) + *found = NULL; + +- foreach_ticket(i, tk) { ++ FOREACH_TICKET(i, tk) { + if (!strncmp(tk->name, ticket, sizeof(tk->name))) { + if (found) + *found = tk; +@@ -406,7 +406,7 @@ int list_ticket(char **pdata, unsigned int *len) + + alloc = booth_conf->ticket_count * (BOOTH_NAME_LEN * 2 + 128 + 16); + +- foreach_ticket(i, tk) { ++ FOREACH_TICKET(i, tk) { + multiple_grant_warning_length = number_sites_marked_as_granted(tk); + + if (multiple_grant_warning_length > 1) { +@@ -420,7 +420,7 @@ int list_ticket(char **pdata, unsigned int *len) + return -ENOMEM; + + cp = data; +- foreach_ticket(i, tk) { ++ FOREACH_TICKET(i, tk) { + if ((!is_manual(tk)) && is_time_set(&tk->term_expires)) { + /* Manual tickets doesn't have term_expires defined */ + ts = wall_ts(&tk->term_expires); +@@ -468,7 +468,7 @@ int list_ticket(char **pdata, unsigned int *len) + } + } + +- foreach_ticket(i, tk) { ++ FOREACH_TICKET(i, tk) { + multiple_grant_warning_length = number_sites_marked_as_granted(tk); + + if (multiple_grant_warning_length > 1) { +@@ -477,7 +477,7 @@ int list_ticket(char **pdata, unsigned int *len) + "\nWARNING: The ticket %s is granted to multiple sites: ", // ~55 characters + tk->name); + +- foreach_node(site_index, site) { ++ FOREACH_NODE(site_index, site) { + if (tk->sites_where_granted[site_index] > 0) { + cp += snprintf(cp, + alloc - (cp - data), +@@ -633,7 +633,7 @@ int setup_ticket(void) + struct ticket_config *tk; + int i; + +- foreach_ticket(i, tk) { ++ FOREACH_TICKET(i, tk) { + reset_ticket(tk); + + if (local->type == SITE) { +@@ -860,7 +860,7 @@ static void log_lost_servers(struct ticket_config *tk) + */ + return; + +- foreach_node(i, n) { ++ FOREACH_NODE(i, n) { + if (!(tk->acks_received & n->bitmask)) { + tk_log_warn("%s %s didn't acknowledge our %s, " + "will retry %d times", +@@ -880,7 +880,7 @@ static void resend_msg(struct ticket_config *tk) + if (!(tk->acks_received ^ local->bitmask)) { + ticket_broadcast(tk, tk->last_request, 0, RLT_SUCCESS, 0); + } else { +- foreach_node(i, n) { ++ FOREACH_NODE(i, n) { + if (!(tk->acks_received & n->bitmask)) { + n->resend_cnt++; + tk_log_debug("resending %s to %s", +@@ -1144,7 +1144,7 @@ void process_tickets(void) + int i; + timetype last_cron; + +- foreach_ticket(i, tk) { ++ FOREACH_TICKET(i, tk) { + if (!has_extprog_exited(tk) && + is_time_set(&tk->next_cron) && !is_past(&tk->next_cron)) + continue; +@@ -1168,7 +1168,7 @@ void tickets_log_info(void) + int i; + time_t ts; + +- foreach_ticket(i, tk) { ++ FOREACH_TICKET(i, tk) { + ts = wall_ts(&tk->term_expires); + tk_log_info("state '%s' " + "term %d " +@@ -1366,7 +1366,7 @@ int number_sites_marked_as_granted(struct ticket_config *tk) + int i, result = 0; + struct booth_site *ignored __attribute__((unused)); + +- foreach_node(i, ignored) { ++ FOREACH_NODE(i, ignored) { + result += tk->sites_where_granted[i]; + } + +diff --git a/src/ticket.h b/src/ticket.h +index 59e84c0..d95cf6e 100644 +--- a/src/ticket.h ++++ b/src/ticket.h +@@ -35,12 +35,12 @@ extern int TIME_RES; + #define DEFAULT_RETRIES 10 + + +-#define foreach_ticket(i_, t_) \ ++#define FOREACH_TICKET(i_, t_) \ + for (i_ = 0; \ + (t_ = booth_conf->ticket + i_, i_ < booth_conf->ticket_count); \ + i_++) + +-#define foreach_node(i_, n_) \ ++#define FOREACH_NODE(i_, n_) \ + for (i_ = 0; \ + (n_ = booth_conf->site + i_, i_ < booth_conf->site_count); \ + i_++) +diff --git a/src/transport.c b/src/transport.c +index 8e2d422..cd40e99 100644 +--- a/src/transport.c ++++ b/src/transport.c +@@ -98,7 +98,7 @@ static int find_address(unsigned char ipaddr[BOOTH_IPADDR_LEN], + /* One bit left to check means ignore 7 lowest bits. */ + mask = ~( (1 << (8 - bits_left)) -1); + +- foreach_node(i, node) { ++ FOREACH_NODE(i, node) { + if (family != node->family) + continue; + n_a = node_to_addr_pointer(node); +@@ -895,7 +895,7 @@ static int booth_udp_broadcast_auth(void *buf, int len) + return rv; + + rvs = 0; +- foreach_node(i, site) { ++ FOREACH_NODE(i, site) { + if (site != local) { + rv = booth_udp_send(site, buf, len); + if (!rvs) +-- +2.25.1 + diff --git a/booth.spec b/booth.spec index eaa6729..2cb6589 100644 --- a/booth.spec +++ b/booth.spec @@ -24,7 +24,7 @@ %bcond_with run_build_tests %bcond_with include_unit_test -%global release 1 +%global release 2 ## User and group to use for nonprivileged services (should be in sync with pacemaker) %global uname hacluster @@ -48,6 +48,10 @@ Summary: Ticket Manager for Multi-site Clusters License: GPL-2.0-or-later Url: https://github.com/%{github_owner}/%{name} Source0: https://github.com/%{github_owner}/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.gz +Patch01: backport-Fix-typo-in-wait_child.patch +Patch02: backport-Refactor-Fix-problems-found-by-clang.patch +patch03: backport-Refactor-foreach_-node-ticket-apply-more-universally.patch +patch04: backport-Refactor-rename-foreach_-node-ticket-macros-to-upper.patch # direct build process dependencies BuildRequires: autoconf @@ -296,6 +300,12 @@ VERBOSE=1 make check %{_usr}/lib/ocf/resource.d/booth/sharedrsc %changelog +* Fri Aug 09 2024 bizhiyuan -1.2-2 +- Fix typo in wait_child +- Refactor: foreach_{node,ticket}: apply more universally +- Refactor: rename foreach_{node,ticket} macros to uppercased variants +- Refactor Fix problems found by clang + * Wed Jun 19 2024 bizhiyuan -1.2-1 - Update version to 1.2 -- Gitee