aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2019-01-28 16:11:08 +0100
committerDaniel Willmann <dwillmann@sysmocom.de>2019-07-18 17:35:58 +0200
commit66a83f495f997143ead409d581bd2cd910dad46f (patch)
tree6be24d3628881b7fefb4ece395b2da88f51a853c
parent7648a0eb1824e432075353cde10dffdac1cd295e (diff)
simple_ctrl: Don't cause an error if GET response is empty
Change-Id: I0be48c89595e71ac4dfa1b8ad1890296f2013476 Sponsored-by: On-Waves ehf.
-rw-r--r--src/simple_ctrl.c6
1 files changed, 5 insertions, 1 deletions
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 @@ char *simple_ctrl_get(struct simple_ctrl_handle *sch, const char *var)
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);