Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
{
struct uci_element *e = NULL;
struct uci_ptr ptr;
- int ret = 0;
+ int ret = 1;
if (uci_lookup_ptr(ctx, &ptr, tuple, true) != UCI_OK) {
cli_perror();
uci_show_changes(ptr.p);
break;
case CMD_COMMIT:
- if (flags & CLI_FLAG_NOCOMMIT)
- return 0;
+ if (flags & CLI_FLAG_NOCOMMIT) {
+ ret = 0;
+ goto out;
+ }
if (uci_commit(ctx, &ptr.p, false) != UCI_OK) {
cli_perror();
- ret = 1;
}
break;
case CMD_EXPORT:
if (!(ptr.flags & UCI_LOOKUP_COMPLETE)) {
ctx->err = UCI_ERR_NOTFOUND;
cli_perror();
- ret = 1;
}
switch(e->type) {
case UCI_TYPE_PACKAGE:
break;
default:
/* should not happen */
- return 1;
+ goto out;
}
break;
}
+out:
if (ptr.p)
uci_unload(ctx, ptr.p);
return ret;