Change in osmo-sysmon[master]: simple_ctrl: Don't cause an error if GET response is empty

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/.

laforge gerrit-no-reply at lists.osmocom.org
Fri Nov 8 15:20:24 UTC 2019


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-sysmon/+/16000 )

Change subject: simple_ctrl: Don't cause an error if GET response is empty
......................................................................

simple_ctrl: Don't cause an error if GET response is empty

Change-Id: I0be48c89595e71ac4dfa1b8ad1890296f2013476
Sponsored-by: On-Waves ehf.
---
M src/simple_ctrl.c
1 file changed, 5 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved



diff --git a/src/simple_ctrl.c b/src/simple_ctrl.c
index 883e92f..9407218 100644
--- a/src/simple_ctrl.c
+++ b/src/simple_ctrl.c
@@ -283,7 +283,11 @@
 		return NULL;
 
 	rc = sscanf(msgb_l2(resp), "GET_REPLY %u %ms %ms", &rx_id, &rx_var, &rx_val);
-	if (rc == 3) {
+	if ((rc == 2) || (rc == 3)) {
+		/* If body is empty return an empty string */
+		if (rc == 2)
+			rx_val = strdup("");
+
 		if (rx_id == sch->next_id-1 && !strcmp(var, rx_var)) {
 			free(rx_var);
 			msgb_free(resp);

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-sysmon/+/16000
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sysmon
Gerrit-Branch: master
Gerrit-Change-Id: I0be48c89595e71ac4dfa1b8ad1890296f2013476
Gerrit-Change-Number: 16000
Gerrit-PatchSet: 1
Gerrit-Owner: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191108/0f04e503/attachment.htm>


More information about the gerrit-log mailing list