Hi All, I am getting seg fault sometimes on the uci_lookup_ptr() call. here is the way I call this function:It happens I would say once every couple of hundred calls.I appreciate if someone can help and guide me how to debug this issue.I have tried it with uci package from 2016-02-02
char * get_uci_option_api (char* file_name , char* section_name , char* section_value , char* option_name) { struct uci_element *e; struct uci_section *s = NULL; struct uci_package *pkg; struct uci_context *m_uci; struct uci_ptr ptr; m_uci = uci_alloc_context(); if (!m_uci) return NULL; uci_load ( m_uci , file_name , &pkg); memset(&ptr,0,sizeof(struct uci_ptr)); ptr.option = NULL; ptr.section = section_value; ptr.package = file_name; ptr.value = section_name; if (!uci_lookup_ptr(pkg->ctx, &ptr , NULL , true)) { s = ptr.s; } else s = NULL; if (!s) return NULL; uci_foreach_element (&s->options, e) { if (!strcmp (e->name, option_name)) { struct uci_option *o = uci_to_option (e); if (o->type == UCI_TYPE_STRING) return o->v.string; } return NULL; } Thanks,Farid
_______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel