argc++;
blobmsg_list_for_each(&in->env, var)
- putenv(blobmsg_data(var->data));
+ setenv(blobmsg_name(var->data), blobmsg_data(var->data), 1);
argv = alloca(sizeof(char *) * argc);
argc = 0;
if ((cur = tb[INSTANCE_ATTR_ENV])) {
if (!blobmsg_check_attr_list(cur, BLOBMSG_TYPE_STRING))
return false;
- blobmsg_list_fill(&in->env, blobmsg_data(cur), blobmsg_data_len(cur));
+ blobmsg_list_fill(&in->env, blobmsg_data(cur), blobmsg_data_len(cur), false);
}
if ((cur = tb[INSTANCE_ATTR_DATA])) {
if (!blobmsg_check_attr_list(cur, BLOBMSG_TYPE_STRING))
return false;
- blobmsg_list_fill(&in->data, blobmsg_data(cur), blobmsg_data_len(cur));
+ blobmsg_list_fill(&in->data, blobmsg_data(cur), blobmsg_data_len(cur), false);
}
return true;
}
int
-blobmsg_list_fill(struct blobmsg_list *list, void *data, int len)
+blobmsg_list_fill(struct blobmsg_list *list, void *data, int len, bool array)
{
struct avl_tree *tree = &list->avl;
struct blobmsg_list_node *node;
return -1;
node = (void *) ((char *)ptr + list->node_offset);
- node->avl.key = blobmsg_name(cur);
+ if (array)
+ node->avl.key = blobmsg_data(cur);
+ else
+ node->avl.key = blobmsg_name(cur);
node->data = cur;
if (avl_insert(tree, &node->avl)) {
free(ptr);
avl_for_each_element(&(list)->avl, element, avl)
void __blobmsg_list_init(struct blobmsg_list *list, int offset, int len);
-int blobmsg_list_fill(struct blobmsg_list *list, void *data, int len);
+int blobmsg_list_fill(struct blobmsg_list *list, void *data, int len, bool array);
void blobmsg_list_free(struct blobmsg_list *list);
bool blobmsg_list_equal(struct blobmsg_list *l1, struct blobmsg_list *l2);
void blobmsg_list_move(struct blobmsg_list *list, struct blobmsg_list *src);