projects
/
project
/
uci.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
change uci_list_configs api for proper exception handling
[project/uci.git]
/
file.c
diff --git
a/file.c
b/file.c
index
be63247
..
0a9b180
100644
(file)
--- a/
file.c
+++ b/
file.c
@@
-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;
}
}