Hi Robert,
I think yours is probably the right answer. My mibindex file is NOT well formed
but it does contain a line feed
DIR /mibs<LF>
But the fact that it doesn't get filled with all the mib files raises a flag
anyway. My toolchain doesn't have the dirent.h header and I'm using a custom
implementation coded by another person in my company. There is probably a bug
(or non-compliance) there somewhere.
Thank you all very much for your clarifications
Moreno Floris
-----Original Message-----
From: NetSNMP Mailbox [mailto:net-snmp-m...@freesnmp.com] On Behalf Of Robert
Story
Sent: martedì 8 novembre 2016 21:17
To: Moreno Floris <moreno.flo...@telit.com>
Cc: net-snmp-coders@lists.sourceforge.net
Subject: Re: What's the purpose of mib.c:2824 tmpbuf2[strlen(tmpbuf2)-1] = 0;
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
MF> automatically 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