X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fmountd.git;a=blobdiff_plain;f=ucix.c;h=1e4d1e68c2c48d55f807a0729855452d4e6cac52;hp=66f8d774541ae74d9f86df1966c041fcadec7f2e;hb=d13b58730f92fa645c9caf9954b8305c06bdc11e;hpb=be3b285c88648c24f7e4b36bebac56a95fa80f7e diff --git a/ucix.c b/ucix.c index 66f8d77..1e4d1e6 100644 --- a/ucix.c +++ b/ucix.c @@ -18,7 +18,9 @@ static inline int ucix_get_ptr(struct uci_context *ctx, const char *p, const cha struct uci_context* ucix_init(const char *config_file) { struct uci_context *ctx = uci_alloc_context(); - uci_add_history_path(ctx, "/var/state"); + if(!ctx) + return NULL; + uci_add_delta_path(ctx, "/var/state"); if(uci_load(ctx, config_file, NULL) != UCI_OK) { printf("%s/%s is missing or corrupt\n", ctx->savedir, config_file); @@ -30,6 +32,8 @@ struct uci_context* ucix_init(const char *config_file) struct uci_context* ucix_init_path(const char *path, const char *config_file) { struct uci_context *ctx = uci_alloc_context(); + if(!ctx) + return NULL; if(path) { uci_set_savedir(ctx, path); @@ -44,7 +48,10 @@ struct uci_context* ucix_init_path(const char *path, const char *config_file) void ucix_cleanup(struct uci_context *ctx) { - uci_free_context(ctx); + if(ctx) + { + uci_free_context(ctx); + } } int ucix_save(struct uci_context *ctx, const char *p)