Skip to content

Commit b34ea5e

Browse files
committed
Minor improvement to debug log messages from code review
1 parent 3b23133 commit b34ea5e

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

libclamav/others.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,7 +1460,7 @@ cl_error_t cli_virus_found_cb(cli_ctx *ctx, const char *virname, bool is_potenti
14601460
is_potentially_unwanted ? IndicatorType_PotentiallyUnwanted : IndicatorType_Strong,
14611461
&remove_indicator_error);
14621462
if (!remove_successful) {
1463-
cli_errmsg("Failed to remove indicator from scan evidence: %s\n", ffierror_fmt(remove_indicator_error));
1463+
cli_errmsg("cli_virus_found_cb: Failed to remove indicator from scan evidence: %s\n", ffierror_fmt(remove_indicator_error));
14641464
status = CL_ERROR;
14651465
goto done;
14661466
}
@@ -1474,15 +1474,15 @@ cl_error_t cli_virus_found_cb(cli_ctx *ctx, const char *virname, bool is_potenti
14741474
// Get the index of the last alert.
14751475
size_t num_alerts = json_object_array_length(alerts);
14761476
if (0 == num_alerts) {
1477-
cli_errmsg("Attempting to ignore an alerts, but alert not found in metadata Alerts array.\n");
1477+
cli_errmsg("cli_virus_found_cb: Attempting to ignore an alert, but alert not found in metadata Alerts array.\n");
14781478
status = CL_ERROR;
14791479
goto done;
14801480
}
14811481

14821482
// Remove the alert from the Alerts array.
14831483
json_ret = json_object_array_del_idx(alerts, num_alerts - 1, 1);
14841484
if (0 != json_ret) {
1485-
cli_errmsg("Failed to remove alert from metadata JSON.\n");
1485+
cli_errmsg("cli_virus_found_cb: Failed to remove alert from metadata JSON.\n");
14861486
status = CL_ERROR;
14871487
goto done;
14881488
}
@@ -1501,7 +1501,7 @@ cl_error_t cli_virus_found_cb(cli_ctx *ctx, const char *virname, bool is_potenti
15011501
// Get the index of the last indicator.
15021502
size_t num_indicators = json_object_array_length(indicators);
15031503
if (0 == num_indicators) {
1504-
cli_errmsg("Attempting to ignore an alerts, but alert not found in metadata Alerts array.\n");
1504+
cli_errmsg("cli_virus_found_cb: Attempting to ignore an alert, but alert not found in metadata Alerts array.\n");
15051505
status = CL_ERROR;
15061506
goto done;
15071507
}
@@ -1517,13 +1517,13 @@ cl_error_t cli_virus_found_cb(cli_ctx *ctx, const char *virname, bool is_potenti
15171517
// Add an "Ignored" string to the indicator object.
15181518
json_object *ignored = json_object_new_string("Signature ignored by alert application callback");
15191519
if (!ignored) {
1520-
cli_errmsg("metadata_json_trust_this_layer: no memory for json ignored indicator object\n");
1520+
cli_errmsg("cli_virus_found_cb: no memory for json ignored indicator object\n");
15211521
status = CL_EMEM;
15221522
goto done;
15231523
}
15241524
json_ret = json_object_object_add(indicator_obj, "Ignored", ignored);
15251525
if (0 != json_ret) {
1526-
cli_errmsg("metadata_json_trust_this_layer: Failed to add Ignored boolean to indicator object\n");
1526+
cli_errmsg("cli_virus_found_cb: Failed to add Ignored boolean to indicator object\n");
15271527
status = CL_ERROR;
15281528
goto done;
15291529
}
@@ -1670,11 +1670,13 @@ static cl_error_t append_virus(cli_ctx *ctx, const char *virname, IndicatorType
16701670

16711671
// Set the verdict
16721672
ctx->recursion_stack[ctx->recursion_level].verdict = CL_VERDICT_STRONG_INDICATOR;
1673+
cli_dbgmsg("append_virus: Strong indicator '%s' added to evidence\n", virname);
16731674
} else if (type == IndicatorType_PotentiallyUnwanted) {
16741675
// Set the verdict, but don't override a strong indicator verdict.
16751676
if (CL_VERDICT_STRONG_INDICATOR != ctx->recursion_stack[ctx->recursion_level].verdict) {
16761677
ctx->recursion_stack[ctx->recursion_level].verdict = CL_VERDICT_POTENTIALLY_UNWANTED;
16771678
}
1679+
cli_dbgmsg("append_virus: Potentially Unwanted indicator '%s' added to evidence\n", virname);
16781680
} else if (type == IndicatorType_Weak) {
16791681
cli_dbgmsg("append_virus: Weak indicator '%s' added to evidence\n", virname);
16801682
}

0 commit comments

Comments
 (0)