clamwin/clamav

freshclam returns 1 on up-to-date, but man says 0

Closed this issue · 3 comments

Return codes in freshclam define a value of 0 for FC_SUCCESS and a value of 1 for FC_UPTODATE:

FC_SUCCESS = 0,
FC_UPTODATE = 1,

But the man page for freshclam says these are both 0:
0 : Database is up\-to\-date or successfully updated.

The ability for freshclam to return 0 on FC_SUCCESS or FC_UPTODATE is highly desirable, for compatibility with tools like cronic, or Windows-based scripted execution.

I suspect this could be easily optionalized via a parallel to:

{ "OnUpdateExecute", "on-update-execute", 0, CLOPT_TYPE_STRING, NULL, -1, NULL, 0, OPT_FRESHCLAM, "Run a command after a successful database update.", "command" },

and

clamav/freshclam/manager.c

Lines 2880 to 2881 in 9309a7c

if ((opt = optget (opts, "OnUpdateExecute"))->enabled)
execute ("OnUpdateExecute", opt->strarg, opts);

here:
return updated ? 0 : FC_UPTODATE;

looks like it does not need any changes now, freshclam will return 0 if retcode is <= 1

https://github.com/clamwin/clamav/blob/0.101.1/freshclam/freshclam.c#L761

Confirmed. My installed version was 0.100.2 (epel's 0.100.2-1.el6). This appears like it should be resolved in 0.101.1 and later.

I do not see version 101.1 available in epel-6. I do see

clamd-0.100.3-1.el6.x86_64

This still remains an issue in this version. This is causing our monitoring to fail, and does not allow us to update.

Thanks,
Zach