This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Max gerrit-no-reply at lists.osmocom.orgHello Neels Hofmeyr, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1991 to look at the new patch set (#3). Handle ctrl cmd allocation failures Check that ctrl command was successfully allocated before using it. Fixes: CID163884 Change-Id: Id19e1ce5fae6f936c9ed93f9a6317b57d28d7311 --- M src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c 1 file changed, 19 insertions(+), 18 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/91/1991/3 diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c index 2a15d2e..f01fd14 100644 --- a/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c +++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c @@ -190,21 +190,13 @@ struct ctrl_connection *ctrl, int critical, int warning) { - int new_state = next_state(manager->state, critical, warning), rc; + int new_state = next_state(manager->state, critical, warning); struct ctrl_cmd *rep; - bool send = false; + char *oml_alert = NULL; /* Nothing changed */ if (new_state < 0) return; - - rep = ctrl_cmd_create(tall_mgr_ctx, CTRL_TYPE_SET); - if (!rep) { - LOGP(DTEMP, LOGL_ERROR, "OML alert creation failed.\n"); - } else { - rep->id = talloc_asprintf(rep, "%d", rand()); - rep->variable = "oml-alert"; - } LOGP(DTEMP, LOGL_NOTICE, "Moving from state %s to %s.\n", get_value_string(state_names, manager->state), @@ -219,22 +211,31 @@ break; case STATE_WARNING: execute_warning_act(manager); - rep->value = "Temperature Warning"; - send = true; + oml_alert = "Temperature Warning"; break; case STATE_CRITICAL: execute_critical_act(manager); - rep->value = "Temperature Critical"; - send = true; + oml_alert = "Temperature Critical"; break; }; - if (send) { - rc = ctrl_cmd_send(&ctrl->write_queue, rep); - LOGP(DTEMP, LOGL_ERROR, "OML alert sent: %d\n", rc); + if (!oml_alert) + return; + + rep = ctrl_cmd_create(tall_mgr_ctx, CTRL_TYPE_SET); + if (!rep) { + LOGP(DTEMP, LOGL_ERROR, "OML alert creation failed for %s.\n", + oml_alert); + return; } + + rep->id = talloc_asprintf(rep, "%d", rand()); + rep->variable = "oml-alert"; + rep->value = oml_alert; + LOGP(DTEMP, LOGL_ERROR, "OML alert sent: %d\n", + ctrl_cmd_send(&ctrl->write_queue, rep)); talloc_free(rep); -} +} static void temp_ctrl_check(struct ctrl_connection *ctrl) { -- To view, visit https://gerrit.osmocom.org/1991 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Id19e1ce5fae6f936c9ed93f9a6317b57d28d7311 Gerrit-PatchSet: 3 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max <msuraev at sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max <msuraev at sysmocom.de> Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>