Hi,
On Thu, 2013-09-12 at 10:40, Jacob Erlbeck wrote:
On 09/11/2013 08:22 PM, Holger Hans Peter Freyther
wrote:
On Wed, Sep 11, 2013 at 10:46:58AM +0200, Jacob
Erlbeck wrote:
When verification failed and the reply string was
not updated, the
message "Someone forgot to fill in the reply." was shown instead
of the default "Value failed verification." message.
could you please
comment on the patch?
> This patch modifies the implementation to set the default message
> if and only if verification fails and the reply hasn't been changed.
Having thought a little bit more about that, I'd rather modify
ctrl_cmd_handle()
to set cmd->reply at the end when it's still NULL and leave
ctrl_cmd_exec() like
it was:
this looks better, yeah.
--- a/openbsc/src/libctrl/control_if.c
+++ b/openbsc/src/libctrl/control_if.c
@@ -147,7 +147,7 @@ int ctrl_cmd_handle(struct ctrl_cmd *cmd, void *data)
vector vline, cmdvec, cmds_vec;
ret = CTRL_CMD_ERROR;
- cmd->reply = "Someone forgot to fill in the reply.";
+ cmd->reply = NULL;
node = CTRL_NODE_ROOT;
cmd->node = net;
@@ -238,6 +238,14 @@ int ctrl_cmd_handle(struct ctrl_cmd *cmd, void *data)
cmd_free_strvec(vline);
err:
+ if (!cmd->reply) {
+ LOGP(DCTRL, LOGL_ERROR, "cmd->replay has not been set.\n", ret);
+ if (ret == CTRL_CMD_ERROR)
+ cmd->reply = "An error has occured.";
+ else
+ cmd->reply = "Command has been handled.";
+ }
+
if (ret == CTRL_CMD_ERROR)
cmd->type = CTRL_TYPE_ERROR;
return ret;
Regards,
- Daniel Willmann <dwillmann(a)sysmocom.de>
http://www.sysmocom.de/
=======================================================================
* sysmocom - systems for mobile communications GmbH
* Schivelbeiner Str. 5
* 10439 Berlin, Germany
* Sitz / Registered office: Berlin, HRB 134158 B
* Geschaeftsfuehrer / Managing Directors: Holger Freyther, Harald Welte