[Clam-devel] SMSBatch bug: too much opened files.

Pau Arumi parumi at iua.upf.edu
Fri Mar 30 03:45:08 PDT 2007


your patch have also been commited.
even small details are useful. thanks!


En/na Hernán Ordiales ha escrit:
> i've opened this patch just for fun and to start getting involved with
> this list and i've noticed that if the file descriptor "mFile" is
> different from '-1' you're double checking it with if without sense...
> 
> what an optimization! :-)
> 
> i mean:
> 
> Index: CLAM/src/Tools/SDIF/SDIFFile.cxx
> ===================================================================
> --- CLAM/src/Tools/SDIF/SDIFFile.cxx    (revisión: 9886)
> +++ CLAM/src/Tools/SDIF/SDIFFile.cxx    (copia de trabajo)
> @@ -68,11 +68,12 @@
>         if (mFile==-1)                                                // 
> if open file error
>         {
>             //Open the file only if unopened
>             mFile = open(mpName,mode,0644);
> +       
> +            if 
> (mFile==-1)                                                // if open 
> file error
> +            {
> +                throw CLAM::ErrOpenFile(mpName);             // throw 
> filename
> +            }
>         }
> -        if (mFile==-1)                                                
> // if open file error
> -        {
> -            throw CLAM::ErrOpenFile(mpName);             // throw filename
> -        }
>         mSize = lseek(mFile,0,SEEK_END);
>         lseek(mFile,0,SEEK_SET);
>     }
> 
> just that
> 
> cheers,
> 
> 
> ------------------------------------------------------------------------
> 
> Index: CLAM/src/Tools/SDIF/SDIFFile.cxx
> ===================================================================
> --- CLAM/src/Tools/SDIF/SDIFFile.cxx	(revisión: 9886)
> +++ CLAM/src/Tools/SDIF/SDIFFile.cxx	(copia de trabajo)
> @@ -68,11 +68,12 @@
>  		{
>  			//Open the file only if unopened
>  			mFile = open(mpName,mode,0644);
> +		
> +			if (mFile==-1)												// if open file error
> +			{
> +				throw CLAM::ErrOpenFile(mpName); 			// throw filename
> +			}
>  		}
> -		if (mFile==-1)												// if open file error
> -		{
> -			throw CLAM::ErrOpenFile(mpName); 			// throw filename
> -		}
>  		mSize = lseek(mFile,0,SEEK_END);
>  		lseek(mFile,0,SEEK_SET);
>  	}
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Clam-devel mailing list
> Clam-devel at llistes.projectes.lafarga.org
> https://llistes.projectes.lafarga.org/cgi-bin/mailman/listinfo/clam-devel





More information about the clam-devel mailing list