int c;
UCI_INTERNAL(uci_parse_argument, ctx, ctx->pctx->file, &str, &arg);
+ if (str && *str) {
+ goto error;
+ }
for (c = 0; c <= __UCI_CMD_LAST; c++) {
if (uci_command_char[c] == *arg)
break;
goto error;
if (ptr->flags & UCI_LOOKUP_EXTENDED)
goto error;
+ if (c != UCI_CMD_REMOVE && !ptr->value) {
+ goto error;
+ }
switch(c) {
case UCI_CMD_REORDER:
--- /dev/null
+test_changes_tailing_parts()
+{
+ local c val
+ for c in + '' @ ^ '|' '~'; do
+ touch ${CONFIG_DIR}/network
+ cat >${CHANGES_DIR}/network <<-EOF
+ ${c}network.foo bar
+ ${c}network.foo bar=baz
+ ${c}network.foo.bar baz
+ ${c}network.foo.bar baz=bazz
+ EOF
+ val=$(${UCI} changes)
+ assertNotSegFault "$?"
+ assertNull "$val"
+ done
+}
+
+test_changes_missing_value()
+{
+ local c val
+ for c in + '' @ ^ '|' '~'; do
+ touch ${CONFIG_DIR}/network
+ mkdir -p ${CHANGES_DIR}
+ cat >${CHANGES_DIR}/network <<-EOF
+ ${c}network.foo
+ ${c}network.foo.bar
+ EOF
+ val=$(${UCI} changes)
+ assertNotSegFault "$?"
+ assertNull "$val"
+ done
+}