X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fuci.git;a=blobdiff_plain;f=list.c;h=0ea7eda95cb5509f673c06464dfe6dc4818125ca;hp=f47b5a83655729e00d46ba6b73daf852f453f50c;hb=42429219a90d697d88c5203bddef34c31e552643;hpb=e4516d01a7d2b0a5a8def7b5791c7d4032138287 diff --git a/list.c b/list.c index f47b5a8..0ea7eda 100644 --- a/list.c +++ b/list.c @@ -515,12 +515,13 @@ int uci_rename(struct uci_context *ctx, struct uci_ptr *ptr) int uci_reorder_section(struct uci_context *ctx, struct uci_section *s, int pos) { struct uci_package *p = s->package; + bool internal = ctx && ctx->internal; char order[32]; UCI_HANDLE_ERR(ctx); uci_list_set_pos(&s->package->sections, &s->e.list, pos); - if (!ctx->internal && p->has_delta) { + if (!internal && p->has_delta) { sprintf(order, "%d", pos); uci_add_delta(ctx, &p->delta, UCI_CMD_REORDER, s->e.name, NULL, order); } @@ -559,7 +560,7 @@ int uci_delete(struct uci_context *ctx, struct uci_ptr *ptr) UCI_ASSERT(ctx, ptr->s); - if (ptr->value && ptr->o && ptr->o->type == UCI_TYPE_LIST) { + if (ptr->o && ptr->o->type == UCI_TYPE_LIST && ptr->value && *ptr->value) { if (!sscanf(ptr->value, "%d", &index)) return 1;