diff options
author | Yousong Zhou <yszhou4tech@gmail.com> | 2015-03-18 12:44:44 +0800 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2015-03-26 21:38:05 +0100 |
commit | 54ca5ae34788d4fc6afc10dfbed69517badf5cd8 (patch) | |
tree | 9e44428530f8b1418e03851b9c0c42fea6c1a4fc | |
parent | 90ba7cac9dc74210424d8b09229cdd29571fbcc1 (diff) | |
download | uci-54ca5ae34788d4fc6afc10dfbed69517badf5cd8.tar.gz |
cli: fix return value of package_cmd().
It's a bug revealed by commit 446e774 "cli: properly unload package
before quit". The current code would exit with value 1 even if
uci_export() succceeded.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
-rw-r--r-- | cli.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -305,10 +305,13 @@ static int package_cmd(int cmd, char *tuple) } if (uci_commit(ctx, &ptr.p, false) != UCI_OK) { cli_perror(); + goto out; } break; case CMD_EXPORT: - uci_export(ctx, stdout, ptr.p, true); + if (uci_export(ctx, stdout, ptr.p, true) != UCI_OK) { + goto out; + } break; case CMD_SHOW: if (!(ptr.flags & UCI_LOOKUP_COMPLETE)) { @@ -333,6 +336,8 @@ static int package_cmd(int cmd, char *tuple) break; } + ret = 0; + out: if (ptr.p) uci_unload(ctx, ptr.p); |