On 11/11/2011 05:46 PM, Niels Baggesen wrote:
> Den 11-11-2011 13:04, Timo Teräs skrev:
>> * netsnmp-swinst-crash.patch
>> - fixes a crash (happens at least on uclibc systems) when a
>> closedir(NULL) is executed under certain conditions
>
> I would like to fix this in a different way. What do you think about
> this patch:
>
> --- a/agent/mibgroup/host/data_access/swinst_pkginfo.c
> +++ b/agent/mibgroup/host/data_access/swinst_pkginfo.c
> @@ -103,7 +103,9 @@ netsnmp_swinst_arch_load( netsnmp_container
> *container, u_int flags)
> if there isn't a list of them! */
> }
> d = opendir( pkg_directory );
> - while (d != NULL && (dp = readdir(d)) != NULL) {
> + if (!d)
> + return 1;
> + while ((dp = readdir(d)) != NULL) {
> if ( '.' == dp->d_name[0] )
> continue;
> entry = netsnmp_swinst_entry_create( i++ );
>
> This seems like a better way to handle the missing directory
Looks about right, assuming there's no clean up skipped. I just did the
patch as a immediate fix without analysing the function further.
I also filed a sf.net tracker item about this...
- Timo
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders