[prev in list] [next in list] [prev in thread] [next in thread] 

List:       net-snmp-bugs
Subject:    [ net-snmp-Bugs-1529523 ] Making snmpget main() reentrant.
From:       "SourceForge.net" <noreply () sourceforge ! net>
Date:       2006-07-27 8:05:04
Message-ID: E1G60rg-0000Bg-Af () sc8-sf-web6 ! sourceforge ! net
[Download RAW message or body]

Bugs item #1529523, was opened at 2006-07-27 01:05
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112694&aid=1529523&group_id=12694

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: apps
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: Making snmpget main() reentrant.

Initial Comment:
I wrote a dll wrapper to main so I could do snmpgets 
from visual basic. 

I found that after an error occurred, the main() could 
not be called again because static information was not 
reset. 

Here's the code I had to change to fix this:

1. Add this code to the very top of main, after the 
declarations

	failures = 0;
	g_nErrorValue = 0;
	g_pstrResult = NULL;
	g_pstrErrorMessage = NULL;

Actually I think only "failures" needed to be zeroed.

2. snmp_close was not called on the early exit if 
there were any failures

    if (failures) {
		snmp_close(ss);	// added
	        SOCK_CLEANUP;
        exit(1);
    }


HTH
plq     att timetrials dott co  doottt uk



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112694&aid=1529523&group_id=12694

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Net-snmp-bugs mailing list
Net-snmp-bugs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-bugs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic