On 28/09/06, danny zhong <[EMAIL PROTECTED]> wrote:
> it will execute a "C" execution file called infin. the infin.c is :
>
> #include<stdio.h>
>
> int main(void){
> system("./infin2 &");
>
> }

That code assumes that the program is run from a particular location.
This may well not be true when triggering this via procfix.
It would be much safer to hard-code the full path to "infin2".

It's also a bit of a cheat to use "system()" for this sort of task.
It would be more appropriate to use "fork()" and "exec()" to fire off infin2.
If nothing else, you could at least check for errors (which you don't
currently do!)

Or ideally, re-work infin2 to use fork() itself - so it can detach
itself from the controlling terminal and run itself in the background.
 That would be the usual way of coding a network daemon.

See "netsnmp_daemonize()" in the file snmplib/system.c for an example
of doing this.

Dave

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to