projects
/
project
/
uci.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
free the history on package unload
[project/uci.git]
/
file.c
diff --git
a/file.c
b/file.c
index
be63247
..
47d9c44
100644
(file)
--- a/
file.c
+++ b/
file.c
@@
-545,7
+545,7
@@
static FILE *uci_open_stream(struct uci_context *ctx, const char *filename, int
UCI_THROW(ctx, UCI_ERR_NOTFOUND);
}
UCI_THROW(ctx, UCI_ERR_NOTFOUND);
}
- fd = open(filename, (write ? O_RDWR | O_CREAT : O_RDONLY));
+ fd = open(filename, (write ? O_RDWR | O_CREAT : O_RDONLY)
, UCI_FILEMODE
);
if (fd <= 0)
goto error;
if (fd <= 0)
goto error;
@@
-749,7
+749,7
@@
int uci_save(struct uci_context *ctx, struct uci_package *p)
fprintf(f, "\n");
else
fprintf(f, "=%s\n", h->value);
fprintf(f, "\n");
else
fprintf(f, "=%s\n", h->value);
- uci_
list_del(&e->list
);
+ uci_
free_history(h
);
}
done:
}
done:
@@
-802,15
+802,17
@@
static inline char *get_filename(char *path)
return p;
}
return p;
}
-
char **uci_list_configs(struct uci_context *ctx
)
+
int uci_list_configs(struct uci_context *ctx, char ***list
)
{
char **configs;
glob_t globbuf;
int size, i;
char *buf;
{
char **configs;
glob_t globbuf;
int size, i;
char *buf;
+ UCI_HANDLE_ERR(ctx);
+
if (glob(UCI_CONFDIR "/*", GLOB_MARK, NULL, &globbuf) != 0)
if (glob(UCI_CONFDIR "/*", GLOB_MARK, NULL, &globbuf) != 0)
-
return NULL
;
+
UCI_THROW(ctx, UCI_ERR_NOTFOUND)
;
size = sizeof(char *) * (globbuf.gl_pathc + 1);
for(i = 0; i < globbuf.gl_pathc; i++) {
size = sizeof(char *) * (globbuf.gl_pathc + 1);
for(i = 0; i < globbuf.gl_pathc; i++) {
@@
-836,6
+838,8
@@
char **uci_list_configs(struct uci_context *ctx)
strcpy(buf, p);
buf += strlen(buf) + 1;
}
strcpy(buf, p);
buf += strlen(buf) + 1;
}
- return configs;
+ *list = configs;
+
+ return 0;
}
}