9 Commits

Author SHA1 Message Date
ca110us
3ef7191ecf Merge pull request #2 from ndrpnt/main
Make Free() return Go error instead of C error code
2022-04-22 15:11:54 +08:00
ca110us
817805f598 Merge pull request #1 from ndrpnt/fix-scanmap
Fix ScanMapCB success return value
2022-04-22 15:06:47 +08:00
ndrpnt
cfcfbd4360 Make Free() return Go error instead of C error code 2022-04-21 11:10:10 +02:00
ndrpnt
69c0d2a4e1 Fix ScanMapCB success return value 2022-04-20 16:13:14 +02:00
ca110us
690024f64a modify .gitattributes 2022-03-30 15:00:44 +08:00
ca110us
d8621d034e add .gitattributes 2022-03-30 14:59:59 +08:00
ca110us
946c4b64ba modify README 2022-03-30 14:39:03 +08:00
ca110us
4fee3e0db2 move prepare.sh 2022-03-30 14:21:30 +08:00
ca110us
23c4b7a54c add Static build 2022-03-30 14:12:40 +08:00
2 changed files with 8 additions and 3 deletions

1
.gitattributes vendored Normal file
View File

@@ -0,0 +1 @@
*.yar linguist-vendored

View File

@@ -176,8 +176,12 @@ func (c *Clamav) EngineGetNum(field EngineField) (uint64, error) {
// Free the memory allocated to clamav instance, Free should be called // Free the memory allocated to clamav instance, Free should be called
// when the engine is no longer in use. // when the engine is no longer in use.
func (c *Clamav) Free() int { func (c *Clamav) Free() error {
return int(C.cl_engine_free((*C.struct_cl_engine)(c.engine))) ret := ErrorCode(C.cl_engine_free((*C.struct_cl_engine)(c.engine)))
if ret == CL_SUCCESS {
return nil
}
return Strerr(ret)
} }
// ScanMapCB scans custom data // ScanMapCB scans custom data
@@ -198,7 +202,7 @@ func (c *Clamav) ScanMapCB(fmap *Fmap, fileName string, context interface{}) (ui
defer CloseMemory(fmap) defer CloseMemory(fmap)
// clean // clean
if ret == CL_SUCCESS { if ret == CL_SUCCESS {
return 0, "", nil return uint(scanned), "", nil
} }
// virus // virus
if ret == CL_VIRUS { if ret == CL_VIRUS {