On Tue, 8 Nov 2016 16:35:46 +0000 Moreno wrote:
MF> As requested in the sujbect, what's the purpose of line 2824 in mib.c file?
MF> 
MF> tmpbuf2[strlen(tmpbuf2)-1] = 0;
MF> 
MF> It causes my "/mibs" directory to be trimmed to "/mib" and nothing works.

Then it sounds like your mibindex file is not well formed. It should start
with a DIR line, followed by a line for each mib. e.g.

--- start ---
DIR /usr/share/snmp/mibs
AGENTX-MIB AGENTX-MIB.txt
--- end ---

The first line is read by fgets():

       fgets()  reads in at most one less than size characters from stream and
       stores them into the buffer pointed to by s.  Reading  stops  after  an
       EOF  or a newline.  If a newline is read, it is stored into the buffer.

So the strlen - 1 chops off the newline.

MF> Also, I had to memset to 0 all the buffers for peace of mind because
MF> I'm porting netsnmp to an embedded plaform that doesn't automatically
MF> set to zero static variables and arrays on declaration.

Static buffers/arrays should be initialized before use. If you find any that
are used before they are initialized, please file a bug and, if you can,
submit a patch to fix them.

-- 
Robert

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to