X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fuci.git;a=blobdiff_plain;f=file.c;h=0a9b180921d3c5ba28170969301197137ed81efe;hp=be63247be7da3eec4d5c7472168bd30b7d506ba3;hb=78f76bde7306cc9dd501b5325b2e40af8b22ad51;hpb=92f4eac56f3cf1bf21c352193e3bf40723a6e87f diff --git a/file.c b/file.c index be63247..0a9b180 100644 --- a/file.c +++ b/file.c @@ -802,15 +802,17 @@ static inline char *get_filename(char *path) 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; + UCI_HANDLE_ERR(ctx); + 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++) { @@ -836,6 +838,8 @@ char **uci_list_configs(struct uci_context *ctx) strcpy(buf, p); buf += strlen(buf) + 1; } - return configs; + *list = configs; + + return 0; }