Re: [Clamav-devel] Help to fix some code with new API

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Török Edwin
Date:  
To: ClamAV Development
Subject: Re: [Clamav-devel] Help to fix some code with new API
On 2009-03-25 19:54, Renato Botelho wrote:
> On Wed, Mar 25, 2009 at 2:46 PM, Renato Botelho <> wrote:
>
>> On Wed, Mar 25, 2009 at 2:14 PM, Gianluigi Tiesi <> wrote:
>>
>>> -----BEGIN PGP SIGNED MESSAGE-----
>>> Hash: SHA1
>>>
>>> Renato Botelho wrote:
>>>
>>>> Hello,
>>>>
>>>> I want to update clamav to 0.95 on FreeBSD ports collection, but,
>>>> before it I need to have all dependant ports working fine.
>>>>
>>>> I've contacted some maintainers / authors and got fixes, but, there
>>>> are 2 of them missing and I tried to fix it by myself.
>>>>
>>>> Could anyone take a look at those patches and let me know if I
>>>> missed something? They are building fine, but it doesn't mean
>>>> they are working fine.
>>>>
>>>>
>>> - - limits are gone
>>> - - you should use cl_engine_set_num() to set maxfilesize and friends
>>> - - you need cl_init(CL_INIT_DEFAULT)
>>>
>
> Wrong code, now:
>
> static struct cl_engine *root;
>
> if ((err = cl_init(CL_INIT_DEFAULT)))
> throw cException(CLAMAV_CLASS_NAME,CLAMAV_CLASS_NAME,"cl_init",err);
>
> root = cl_engine_new();
>


You should check for failure here (== NULL).

> if ((err = cl_load(cl_retdbdir(), root, &signo, CL_DB_STDOPT)))
> throw cException(CLAMAV_CLASS_NAME,CLAMAV_CLASS_NAME,"cl_load",err);
>
> if ((err = cl_engine_compile(root)))
> throw cException(CLAMAV_CLASS_NAME,CLAMAV_CLASS_NAME,"cl_engine_compile",err);
>
> cl_engine_free(root);
>


You should check for error here too.

Yes, that should be right, see also
https://wiki.clamav.net/Main/UpgradeNotes095#Upgrading_to_the_new_libclamav_A

When you are done upgrading it would be nice to test these programs by
trying to scan test/clam.exe.

Best regards,
--Edwin
_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html
Please submit your patches to our Bugzilla: http://bugs.clamav.net