diff options
| author | Jan Venekamp | 2023-07-14 18:28:10 +0000 |
|---|---|---|
| committer | Hauke Mehrtens | 2023-08-10 17:42:57 +0000 |
| commit | 3cda25127b1963ae7167e8a01a7bcacc7c89c29c (patch) | |
| tree | f2b8dea8f6c34467c057e36e5e2abf4bfc01ef4e | |
| parent | 04d0c46cfe30f557da0c603516636830cab4a08a (diff) | |
| download | uci-3cda25127b1963ae7167e8a01a7bcacc7c89c29c.tar.gz | |
file: Fix uci -m import command
Without this change we see the following error:
# uci -m import optic < /etc/optic-db/default
uci: Parse error (option/list command found before the first section) at line 4, byte 1
ptr.last is still a null pointer in case the uci_lookup_list() call
found a matching section and set ptr.s to it. The code expects that
uci_set() updates the ptr.last pointer, but this is not done any more.
If case uci_lookup_list() did not found a section ptr->s is a null
pointer and then uci_set() will allocate a new section.
Fixes: ae61e1cad4a1 ("uci: optimize update section in uci_set")
Co-authored-by: Hauke Mehrtens <hmehrtens@maxlinear.com>
Signed-off-by: Jan Venekamp <jan@venekamp.net>
| -rw-r--r-- | file.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -459,7 +459,7 @@ static void uci_parse_config(struct uci_context *ctx) ctx->internal = !pctx->merge; UCI_NESTED(uci_set, ctx, &ptr); - pctx->section = uci_to_section(ptr.last); + pctx->section = ptr.s; } } |