Browse code

clamonacc: --wait, --watch-list bugs

clamonacc's --wait option was broken and would exit as soon as clamd
responded, rather than starting clamonacc. The fix is simply to return
"success" when the pong is received, rather than "break".

clamonacc's --watch-list option's short-hand "-w" conflicts with the
--wait option's "-w" short-hand. This causes --watch-list to be
non-functional, invoking the --wait option when you use --watch-list.
This patch switches the --watch-list short-hand to "-W".

Micah Snyder authored on 2020/12/24 16:33:07
Showing 2 changed files
... ...
@@ -382,7 +382,7 @@ static int startup_checks(struct onas_context *ctx)
382 382
         int16_t ping_result = onas_ping_clamd(&ctx);
383 383
         switch (ping_result) {
384 384
             case 0:
385
-                ret = (int)CL_BREAK;
385
+                ret = (int)CL_SUCCESS;
386 386
                 break;
387 387
             case 1:
388 388
                 ret = (int)CL_ETIMEOUT;
... ...
@@ -428,7 +428,7 @@ void help(void)
428 428
     mprintf("    --verbose              -v          Be verbose\n");
429 429
     mprintf("    --log=FILE             -l FILE     Save scanning output to FILE\n");
430 430
     mprintf("    --foreground           -F          Output to foreground and do not daemonize\n");
431
-    mprintf("    --watch-list=FILE      -w FILE     Watch directories from FILE\n");
431
+    mprintf("    --watch-list=FILE      -W FILE     Watch directories from FILE\n");
432 432
     mprintf("    --exclude-list=FILE    -e FILE     Exclude directories from FILE\n");
433 433
     mprintf("    --ping                 -p A[:I]    Ping clamd up to [A] times at optional interval [I] until it responds.\n");
434 434
     mprintf("    --wait                 -w          Wait up to 30 seconds for clamd to start. Optionally use alongside --ping to set attempts [A] and interval [I] to check clamd.\n");
... ...
@@ -476,7 +476,7 @@ const struct clam_option __clam_options[] = {
476 476
 
477 477
     /* clamonacc cmdline options */
478 478
 
479
-    {NULL, "watch-list", 'w', CLOPT_TYPE_STRING, NULL, -1, NULL, 0, OPT_CLAMONACC, "", ""},
479
+    {NULL, "watch-list", 'W', CLOPT_TYPE_STRING, NULL, -1, NULL, 0, OPT_CLAMONACC, "", ""},
480 480
     {NULL, "exclude-list", 'e', CLOPT_TYPE_STRING, NULL, -1, NULL, 0, OPT_CLAMONACC, "", ""},
481 481
 
482 482
     /* FIXME: mark these as private and don't output into clamd.conf/man */