summaryrefslogtreecommitdiff
path: root/degesch.c
diff options
context:
space:
mode:
Diffstat (limited to 'degesch.c')
-rw-r--r--degesch.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/degesch.c b/degesch.c
index de40462..a60c4e9 100644
--- a/degesch.c
+++ b/degesch.c
@@ -3835,6 +3835,8 @@ handle_command_set_add
struct str_vector items;
str_vector_init (&items);
split_str (item->value.string.str, ',', &items);
+ if (items.len == 1 && !*items.vector[0])
+ str_vector_reset (&items);
if (str_vector_find (&items, value) != -1)
error_set (e, "already present in the array: %s", value);
@@ -3856,6 +3858,8 @@ handle_command_set_remove
struct str_vector items;
str_vector_init (&items);
split_str (item->value.string.str, ',', &items);
+ if (items.len == 1 && !*items.vector[0])
+ str_vector_reset (&items);
ssize_t i = str_vector_find (&items, value);
if (i == -1)
@@ -3870,14 +3874,6 @@ handle_command_set_remove
return result;
}
-static bool
-handle_command_set_replace (struct app_context *ctx,
- struct config_item_ *item, struct config_item_ *new_, struct error **e)
-{
- // TODO: replace the item (or log error)
- return false;
-}
-
static void
handle_command_set_assign_item (struct app_context *ctx,
char *key, struct config_item_ *new_, bool add, bool remove)
@@ -3895,7 +3891,7 @@ handle_command_set_assign_item (struct app_context *ctx,
else if (remove)
handle_command_set_remove (item, new_->value.string.str, &e);
else
- handle_command_set_replace (ctx, item, new_, &e);
+ config_item_set_from (item, config_item_clone (new_), &e);
if (e)
{