projects
/
project
/
mountd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
filesystem mount options in uci as optional parameter
[project/mountd.git]
/
uci.c
diff --git
a/uci.c
b/uci.c
index
4f7adb8
..
46c3922
100644
(file)
--- a/
uci.c
+++ b/
uci.c
@@
-28,7
+28,7
@@
struct uci_package *p = NULL;
struct uci_context* uci_init(char *config_file)
{
struct uci_context *ctx = uci_alloc_context();
struct uci_context* uci_init(char *config_file)
{
struct uci_context *ctx = uci_alloc_context();
- uci_add_
history
_path(ctx, "/var/state");
+ uci_add_
delta
_path(ctx, "/var/state");
if(uci_load(ctx, config_file, &p) != UCI_OK)
{
log_printf("/etc/config/%s is missing or corrupt\n", config_file);
if(uci_load(ctx, config_file, &p) != UCI_OK)
{
log_printf("/etc/config/%s is missing or corrupt\n", config_file);
@@
-54,6
+54,9
@@
char* uci_get_option(struct uci_context *ctx, char *section, char *option)
char *value = NULL;
struct uci_ptr ptr;
char *value = NULL;
struct uci_ptr ptr;
+ if (!p)
+ return NULL;
+
memset(&ptr, 0, sizeof(ptr));
ptr.package = p->e.name;
ptr.section = section;
memset(&ptr, 0, sizeof(ptr));
ptr.package = p->e.name;
ptr.section = section;
@@
-101,6
+104,9
@@
void uci_for_each_section_type(char *type, void (*cb)(char*, void*), void *priv)
{
struct uci_element *e;
{
struct uci_element *e;
+ if (!p)
+ return;
+
uci_foreach_element(&p->sections, e)
if (!strcmp(type, uci_to_section(e)->type))
cb(e->name, priv);
uci_foreach_element(&p->sections, e)
if (!strcmp(type, uci_to_section(e)->type))
cb(e->name, priv);