[Ntop-dev] "Utility: Data Dump is broken"

xinan.tang at sbcglobal.net xinan.tang at sbcglobal.net
Tue Sep 1 04:46:16 CEST 2009


What do the following two statements mean?
 
    signal(SIGALRM, quitNow);
    alarm(120); /* Don't freeze */

It will make the else branch quit execution, won't it?
 
If so, the child process will return right away and the following code will not be executed. That is what I observed.
 
--Xinan 


--- On Mon, 8/31/09, Luca Deri <deri at ntop.org> wrote:


From: Luca Deri <deri at ntop.org>
Subject: Re: [Ntop-dev] "Utility: Data Dump is broken"
To: ntop-dev at unipi.it, xinan.tang at sbcglobal.net
Date: Monday, August 31, 2009, 3:45 PM



On Aug 26, 2009, at 9:18 PM, xinan.tang at sbcglobal.net wrote:

> After several-day hacking, I finally make the Data Dump working again. The version based is 3.3.10.
> 
> First,  here is deadcode in http.c starting at line 2681,  the parent will return(0) in the then branch and the child will quit (signal(SIGALRM, quitNow)) in the else branch.  Therefore,  the nested strncasecmp() after that will NEVER be executed, and thus actual function of CONST_DUMP_DATA_HTML will not be executed.
> 
> What is the purpose to have such kind of dead code?

I don't see any dead code. Can you please explain?

Luca

> 
> Thanks
> 
> --Xinan
> 
> 
> 
> -----------------
> else {
>         *usedFork = 1;
>         /* This is zero in the parent copy of the structure */
>         if(myGlobals.childntoppid) {
>           /* father process */
>           myGlobals.numChildren++;
>           compressFile = 0;
>           if(domainNameParm != NULL) free(domainNameParm);
>           if(db_key != NULL) free(db_key);
>           if(db_val != NULL) free(db_val);
>           return(0);
>         } else {
>           detachFromTerminalUnderUnix(0);
>           /* Close inherited sockets */
> #ifdef HAVE_OPENSSL
>           if(myGlobals.sslInitialized) closeNwSocket(&myGlobals.sock_ssl);
> #endif /* HAVE_OPENSSL */
>           if(myGlobals.runningPref.webPort > 0) closeNwSocket(&myGlobals.sock);
> //!#if defined(HAVE_ALARM) && defined(PARM_FORK_CHILD_PROCESS) && (!defined(WIN32))
>           signal(SIGALRM, quitNow);
>           alarm(120); /* Don't freeze */
>         }
>       }
> --------------------------------------------------
> _______________________________________________
> Ntop-dev mailing list
> Ntop-dev at unipi.it
> http://listgateway.unipi.it/mailman/listinfo/ntop-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listgateway.unipi.it/pipermail/ntop-dev/attachments/20090831/c7845a28/attachment.htm>


More information about the Ntop-dev mailing list