> On Mon, 10 Oct 2005 10:59:59 -0300 Jordan wrote: > JJLDS> I´ve developed a agent with 2 tables(control table and > result table). JJLDS> When I query the agent with snmpget or snmpset > everything goes fine. JJLDS> The problem is when I use snmptable. If > the control table is empty, a JJLDS> segmentation fault error > happens when I return NULL(row not found). The JJLDS> same happens > with result table. > > The agent segfaults? What happens if you do snmpgetnext with multiple > varbinds?
Yes. The same of snmptable, segmentation fault when the get_{first, next}. /******************************GET_FIRST************************************/ > JJLDS> marca* ptMarcaTemp = NULL; > JJLDS> netsnmp_variable_list *vptr; > JJLDS> > JJLDS> //Get the first node (line) of the structure (linked list) > JJLDS> ptMarcaTemp = primeiro_no(); /*if ptMarcaTmp is NULL, return NULL*/ > JJLDS> > JJLDS> *my_loop_context = ptMarcaTemp; > JJLDS> *my_data_context = ptMarcaTemp; > JJLDS> > JJLDS> vptr = put_index_data; > JJLDS> > JJLDS> snmp_set_var_value(vptr, (u_char *) &ptMarcaTemp->indice, > sizeof( JJLDS> ptMarcaTemp->indice )); > > If the table is empty, won't ptMarcaTmp be NULL? If so, you shouldn't > dereference it! Sorry, When I copied the code to the e-mail I forgot to copy the line of the return code. Even with this line, nothing occurs. My data structure has top and a bottom nodes to handle every node the same way. Is there another idea? That problem makes me crazy. regards, Jordan. ------------------------------------------------------- This SF.Net email is sponsored by: Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl _______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders