git-svn: trunk@3530
Tomasz Kojm authored on 2008/01/23 21:12:25... | ... |
@@ -1,3 +1,9 @@ |
1 |
+Wed Jan 23 12:49:46 CET 2008 (tk) |
|
2 |
+--------------------------------- |
|
3 |
+ * freshclam/manager.c: reduce the number of error messages (bb#478); |
|
4 |
+ thanks to Vincent Regnard <devel*regnard.org> |
|
5 |
+ * freshclam: new cmdline switch --no-warnings |
|
6 |
+ |
|
1 | 7 |
Tue Jan 22 19:26:04 CET 2008 (tk) |
2 | 8 |
--------------------------------- |
3 | 9 |
* freshclam/manager.c: fix typos introduced in r3503 (thanks Edwin) |
... | ... |
@@ -24,6 +24,9 @@ Be verbose. This option causes freshclam to print many additional informations. |
24 | 24 |
\fB\-\-quiet\fR |
25 | 25 |
Be quiet \- output only error messages. |
26 | 26 |
.TP |
27 |
+\fB\-\-no\-warnings\fR |
|
28 |
+Don't print and log warnings. |
|
29 |
+.TP |
|
27 | 30 |
\fB\-\-stdout\fR |
28 | 31 |
Write all messages to stdout. |
29 | 32 |
.TP |
... | ... |
@@ -125,6 +125,7 @@ static void help(void) |
125 | 125 |
mprintf(" --verbose -v be verbose\n"); |
126 | 126 |
mprintf(" --debug enable debug messages\n"); |
127 | 127 |
mprintf(" --quiet only output error messages\n"); |
128 |
+ mprintf(" --no-warnings don't print and log warnings\n"); |
|
128 | 129 |
mprintf(" --stdout write to stdout instead of stderr\n"); |
129 | 130 |
mprintf("\n"); |
130 | 131 |
mprintf(" --config-file=FILE read configuration from FILE.\n"); |
... | ... |
@@ -161,7 +162,7 @@ static int download(const struct cfgstruct *copt, const struct optstruct *opt, c |
161 | 161 |
return 56; |
162 | 162 |
} else { |
163 | 163 |
while(cpt) { |
164 |
- ret = downloadmanager(copt, opt, cpt->strarg, datadir); |
|
164 |
+ ret = downloadmanager(copt, opt, cpt->strarg, datadir, try == maxattempts - 1); |
|
165 | 165 |
alarm(0); |
166 | 166 |
|
167 | 167 |
if(ret == 52 || ret == 54 || ret == 58 || ret == 59) { |
... | ... |
@@ -210,6 +211,7 @@ int main(int argc, char **argv) |
210 | 210 |
static struct option long_options[] = { |
211 | 211 |
{"help", 0, 0, 'h'}, |
212 | 212 |
{"quiet", 0, 0, 0}, |
213 |
+ {"no-warnings", 0, 0, 0}, |
|
213 | 214 |
{"verbose", 0, 0, 'v'}, |
214 | 215 |
{"debug", 0, 0, 0}, |
215 | 216 |
{"version", 0, 0, 'V'}, |
... | ... |
@@ -366,6 +368,11 @@ int main(int argc, char **argv) |
366 | 366 |
if(opt_check(opt, "quiet")) |
367 | 367 |
mprintf_quiet = 1; |
368 | 368 |
|
369 |
+ if(opt_check(opt, "no-warnings")) { |
|
370 |
+ mprintf_nowarn = 1; |
|
371 |
+ logg_nowarn = 1; |
|
372 |
+ } |
|
373 |
+ |
|
369 | 374 |
if(opt_check(opt, "stdout")) |
370 | 375 |
mprintf_stdout = 1; |
371 | 376 |
|
... | ... |
@@ -145,7 +145,7 @@ static int getclientsock(const char *localip) |
145 | 145 |
return socketfd; |
146 | 146 |
} |
147 | 147 |
|
148 |
-static int wwwconnect(const char *server, const char *proxy, int pport, char *ip, const char *localip, int ctimeout, struct mirdat *mdat) |
|
148 |
+static int wwwconnect(const char *server, const char *proxy, int pport, char *ip, const char *localip, int ctimeout, struct mirdat *mdat, int logerr) |
|
149 | 149 |
{ |
150 | 150 |
int socketfd = -1, port, i, ret; |
151 | 151 |
struct sockaddr_in name; |
... | ... |
@@ -211,7 +211,7 @@ static int wwwconnect(const char *server, const char *proxy, int pport, char *ip |
211 | 211 |
herr = "Unknown error"; |
212 | 212 |
break; |
213 | 213 |
} |
214 |
- logg("!Can't get information about %s: %s\n", hostpt, herr); |
|
214 |
+ logg("%cCan't get information about %s: %s\n", logerr ? '!' : '^', hostpt, herr); |
|
215 | 215 |
close(socketfd); |
216 | 216 |
return -1; |
217 | 217 |
} |
... | ... |
@@ -335,7 +335,7 @@ static char *proxyauth(const char *user, const char *pass) |
335 | 335 |
return auth; |
336 | 336 |
} |
337 | 337 |
|
338 |
-static struct cl_cvd *remote_cvdhead(const char *file, const char *hostname, char *ip, const char *localip, const char *proxy, int port, const char *user, const char *pass, const char *uas, int *ims, int ctimeout, int rtimeout, struct mirdat *mdat) |
|
338 |
+static struct cl_cvd *remote_cvdhead(const char *file, const char *hostname, char *ip, const char *localip, const char *proxy, int port, const char *user, const char *pass, const char *uas, int *ims, int ctimeout, int rtimeout, struct mirdat *mdat, int logerr) |
|
339 | 339 |
{ |
340 | 340 |
char cmd[512], head[513], buffer[FILEBUFF], ipaddr[16], *ch, *tmp; |
341 | 341 |
int bread, cnt, sd; |
... | ... |
@@ -399,9 +399,9 @@ static struct cl_cvd *remote_cvdhead(const char *file, const char *hostname, cha |
399 | 399 |
memset(ipaddr, 0, sizeof(ipaddr)); |
400 | 400 |
|
401 | 401 |
if(ip[0]) /* use ip to connect */ |
402 |
- sd = wwwconnect(ip, proxy, port, ipaddr, localip, ctimeout, mdat); |
|
402 |
+ sd = wwwconnect(ip, proxy, port, ipaddr, localip, ctimeout, mdat, logerr); |
|
403 | 403 |
else |
404 |
- sd = wwwconnect(hostname, proxy, port, ipaddr, localip, ctimeout, mdat); |
|
404 |
+ sd = wwwconnect(hostname, proxy, port, ipaddr, localip, ctimeout, mdat, logerr); |
|
405 | 405 |
|
406 | 406 |
if(sd < 0) { |
407 | 407 |
return NULL; |
... | ... |
@@ -414,7 +414,7 @@ static struct cl_cvd *remote_cvdhead(const char *file, const char *hostname, cha |
414 | 414 |
strcpy(ip, ipaddr); |
415 | 415 |
|
416 | 416 |
if(send(sd, cmd, strlen(cmd), 0) < 0) { |
417 |
- logg("!remote_cvdhead: write failed\n"); |
|
417 |
+ logg("%cremote_cvdhead: write failed\n", logerr ? '!' : '^'); |
|
418 | 418 |
closesocket(sd); |
419 | 419 |
return NULL; |
420 | 420 |
} |
... | ... |
@@ -434,13 +434,13 @@ static struct cl_cvd *remote_cvdhead(const char *file, const char *hostname, cha |
434 | 434 |
closesocket(sd); |
435 | 435 |
|
436 | 436 |
if(bread == -1) { |
437 |
- logg("!remote_cvdhead: Error while reading CVD header from %s\n", hostname); |
|
437 |
+ logg("%cremote_cvdhead: Error while reading CVD header from %s\n", logerr ? '!' : '^', hostname); |
|
438 | 438 |
mirman_update(mdat->currip, mdat, 1); |
439 | 439 |
return NULL; |
440 | 440 |
} |
441 | 441 |
|
442 | 442 |
if((strstr(buffer, "HTTP/1.1 404")) != NULL || (strstr(buffer, "HTTP/1.0 404")) != NULL) { |
443 |
- logg("!CVD file not found on remote server\n"); |
|
443 |
+ logg("%cCVD file not found on remote server\n", logerr ? '!' : '^'); |
|
444 | 444 |
/* mirman_update(mdat->currip, mdat, 1); */ |
445 | 445 |
return NULL; |
446 | 446 |
} |
... | ... |
@@ -457,7 +457,7 @@ static struct cl_cvd *remote_cvdhead(const char *file, const char *hostname, cha |
457 | 457 |
|
458 | 458 |
if(!strstr(buffer, "HTTP/1.1 200") && !strstr(buffer, "HTTP/1.0 200") && |
459 | 459 |
!strstr(buffer, "HTTP/1.1 206") && !strstr(buffer, "HTTP/1.0 206")) { |
460 |
- logg("!Unknown response from remote server\n"); |
|
460 |
+ logg("%cUnknown response from remote server\n", logerr ? '!' : '^'); |
|
461 | 461 |
mirman_update(mdat->currip, mdat, 1); |
462 | 462 |
return NULL; |
463 | 463 |
} |
... | ... |
@@ -475,7 +475,7 @@ static struct cl_cvd *remote_cvdhead(const char *file, const char *hostname, cha |
475 | 475 |
} |
476 | 476 |
|
477 | 477 |
if(sizeof(buffer) - i < 512) { |
478 |
- logg("!remote_cvdhead: Malformed CVD header (too short)\n"); |
|
478 |
+ logg("%cremote_cvdhead: Malformed CVD header (too short)\n", logerr ? '!' : '^'); |
|
479 | 479 |
mirman_update(mdat->currip, mdat, 1); |
480 | 480 |
return NULL; |
481 | 481 |
} |
... | ... |
@@ -484,7 +484,7 @@ static struct cl_cvd *remote_cvdhead(const char *file, const char *hostname, cha |
484 | 484 |
|
485 | 485 |
for(j = 0; j < 512; j++) { |
486 | 486 |
if(!ch || (ch && !*ch) || (ch && !isprint(ch[j]))) { |
487 |
- logg("!remote_cvdhead: Malformed CVD header (bad chars)\n"); |
|
487 |
+ logg("%cremote_cvdhead: Malformed CVD header (bad chars)\n", logerr ? '!' : '^'); |
|
488 | 488 |
mirman_update(mdat->currip, mdat, 1); |
489 | 489 |
return NULL; |
490 | 490 |
} |
... | ... |
@@ -492,7 +492,7 @@ static struct cl_cvd *remote_cvdhead(const char *file, const char *hostname, cha |
492 | 492 |
} |
493 | 493 |
|
494 | 494 |
if(!(cvd = cl_cvdparse(head))) { |
495 |
- logg("!Malformed CVD header (can't parse)\n"); |
|
495 |
+ logg("%cremote_cvdhead: Malformed CVD header (can't parse)\n", logerr ? '!' : '^'); |
|
496 | 496 |
mirman_update(mdat->currip, mdat, 1); |
497 | 497 |
} else { |
498 | 498 |
logg("OK\n"); |
... | ... |
@@ -502,7 +502,7 @@ static struct cl_cvd *remote_cvdhead(const char *file, const char *hostname, cha |
502 | 502 |
return cvd; |
503 | 503 |
} |
504 | 504 |
|
505 |
-static int getfile(const char *srcfile, const char *destfile, const char *hostname, char *ip, const char *localip, const char *proxy, int port, const char *user, const char *pass, const char *uas, int ctimeout, int rtimeout, struct mirdat *mdat) |
|
505 |
+static int getfile(const char *srcfile, const char *destfile, const char *hostname, char *ip, const char *localip, const char *proxy, int port, const char *user, const char *pass, const char *uas, int ctimeout, int rtimeout, struct mirdat *mdat, int logerr) |
|
506 | 506 |
{ |
507 | 507 |
char cmd[512], buffer[FILEBUFF], *ch; |
508 | 508 |
int bread, fd, totalsize = 0, rot = 0, totaldownloaded = 0, |
... | ... |
@@ -549,9 +549,9 @@ static int getfile(const char *srcfile, const char *destfile, const char *hostna |
549 | 549 |
memset(ipaddr, 0, sizeof(ipaddr)); |
550 | 550 |
|
551 | 551 |
if(ip[0]) /* use ip to connect */ |
552 |
- sd = wwwconnect(ip, proxy, port, ipaddr, localip, ctimeout, mdat); |
|
552 |
+ sd = wwwconnect(ip, proxy, port, ipaddr, localip, ctimeout, mdat, logerr); |
|
553 | 553 |
else |
554 |
- sd = wwwconnect(hostname, proxy, port, ipaddr, localip, ctimeout, mdat); |
|
554 |
+ sd = wwwconnect(hostname, proxy, port, ipaddr, localip, ctimeout, mdat, logerr); |
|
555 | 555 |
|
556 | 556 |
if(sd < 0) { |
557 | 557 |
return 52; |
... | ... |
@@ -563,7 +563,7 @@ static int getfile(const char *srcfile, const char *destfile, const char *hostna |
563 | 563 |
strcpy(ip, ipaddr); |
564 | 564 |
|
565 | 565 |
if(send(sd, cmd, strlen(cmd), 0) < 0) { |
566 |
- logg("!getfile: Can't write to socket\n"); |
|
566 |
+ logg("%cgetfile: Can't write to socket\n", logerr ? '!' : '^'); |
|
567 | 567 |
return 52; |
568 | 568 |
} |
569 | 569 |
|
... | ... |
@@ -583,7 +583,7 @@ static int getfile(const char *srcfile, const char *destfile, const char *hostna |
583 | 583 |
#else |
584 | 584 |
if((i >= sizeof(buffer) - 1) || recv(sd, buffer + i, 1, 0) == -1) { |
585 | 585 |
#endif |
586 |
- logg("!getfile: Error while reading database from %s (IP: %s)\n", hostname, ipaddr); |
|
586 |
+ logg("%cgetfile: Error while reading database from %s (IP: %s)\n", logerr ? '!' : '^', hostname, ipaddr); |
|
587 | 587 |
mirman_update(mdat->currip, mdat, 1); |
588 | 588 |
return 52; |
589 | 589 |
} |
... | ... |
@@ -608,7 +608,7 @@ static int getfile(const char *srcfile, const char *destfile, const char *hostna |
608 | 608 |
|
609 | 609 |
if(!strstr(buffer, "HTTP/1.1 200") && !strstr(buffer, "HTTP/1.0 200") && |
610 | 610 |
!strstr(buffer, "HTTP/1.1 206") && !strstr(buffer, "HTTP/1.0 206")) { |
611 |
- logg("!getfile: Unknown response from remote server (IP: %s)\n", ipaddr); |
|
611 |
+ logg("%cgetfile: Unknown response from remote server (IP: %s)\n", logerr ? '!' : '^', ipaddr); |
|
612 | 612 |
mirman_update(mdat->currip, mdat, 1); |
613 | 613 |
closesocket(sd); |
614 | 614 |
return 58; |
... | ... |
@@ -678,15 +678,15 @@ static int getfile(const char *srcfile, const char *destfile, const char *hostna |
678 | 678 |
return 0; |
679 | 679 |
} |
680 | 680 |
|
681 |
-static int getcvd(const char *cvdfile, const char *newfile, const char *hostname, char *ip, const char *localip, const char *proxy, int port, const char *user, const char *pass, const char *uas, int nodb, unsigned int newver, int ctimeout, int rtimeout, struct mirdat *mdat) |
|
681 |
+static int getcvd(const char *cvdfile, const char *newfile, const char *hostname, char *ip, const char *localip, const char *proxy, int port, const char *user, const char *pass, const char *uas, int nodb, unsigned int newver, int ctimeout, int rtimeout, struct mirdat *mdat, int logerr) |
|
682 | 682 |
{ |
683 | 683 |
struct cl_cvd *cvd; |
684 | 684 |
int ret; |
685 | 685 |
|
686 | 686 |
|
687 | 687 |
logg("*Retrieving http://%s/%s\n", hostname, cvdfile); |
688 |
- if((ret = getfile(cvdfile, newfile, hostname, ip, localip, proxy, port, user, pass, uas, ctimeout, rtimeout, mdat))) { |
|
689 |
- logg("!Can't download %s from %s\n", cvdfile, hostname); |
|
688 |
+ if((ret = getfile(cvdfile, newfile, hostname, ip, localip, proxy, port, user, pass, uas, ctimeout, rtimeout, mdat, logerr))) { |
|
689 |
+ logg("%cCan't download %s from %s\n", logerr ? '!' : '^', cvdfile, hostname); |
|
690 | 690 |
unlink(newfile); |
691 | 691 |
return ret; |
692 | 692 |
} |
... | ... |
@@ -749,7 +749,7 @@ static int chdir_tmp(const char *dbname, const char *tmpdir) |
749 | 749 |
return 0; |
750 | 750 |
} |
751 | 751 |
|
752 |
-static int getpatch(const char *dbname, const char *tmpdir, int version, const char *hostname, char *ip, const char *localip, const char *proxy, int port, const char *user, const char *pass, const char *uas, int ctimeout, int rtimeout, struct mirdat *mdat) |
|
752 |
+static int getpatch(const char *dbname, const char *tmpdir, int version, const char *hostname, char *ip, const char *localip, const char *proxy, int port, const char *user, const char *pass, const char *uas, int ctimeout, int rtimeout, struct mirdat *mdat, int logerr) |
|
753 | 753 |
{ |
754 | 754 |
char *tempname, patch[32], olddir[512]; |
755 | 755 |
int ret, fd; |
... | ... |
@@ -767,8 +767,8 @@ static int getpatch(const char *dbname, const char *tmpdir, int version, const c |
767 | 767 |
snprintf(patch, sizeof(patch), "%s-%d.cdiff", dbname, version); |
768 | 768 |
|
769 | 769 |
logg("*Retrieving http://%s/%s\n", hostname, patch); |
770 |
- if((ret = getfile(patch, tempname, hostname, ip, localip, proxy, port, user, pass, uas, ctimeout, rtimeout, mdat))) { |
|
771 |
- logg("!getpatch: Can't download %s from %s\n", patch, hostname); |
|
770 |
+ if((ret = getfile(patch, tempname, hostname, ip, localip, proxy, port, user, pass, uas, ctimeout, rtimeout, mdat, logerr))) { |
|
771 |
+ logg("%cgetpatch: Can't download %s from %s\n", logerr ? '!' : '^', patch, hostname); |
|
772 | 772 |
unlink(tempname); |
773 | 773 |
free(tempname); |
774 | 774 |
chdir(olddir); |
... | ... |
@@ -935,7 +935,7 @@ static int buildcld(const char *tmpdir, const char *dbname, const char *newfile, |
935 | 935 |
return 0; |
936 | 936 |
} |
937 | 937 |
|
938 |
-static int updatedb(const char *dbname, const char *hostname, char *ip, int *signo, const struct cfgstruct *copt, const char *dnsreply, char *localip, int outdated, struct mirdat *mdat) |
|
938 |
+static int updatedb(const char *dbname, const char *hostname, char *ip, int *signo, const struct cfgstruct *copt, const char *dnsreply, char *localip, int outdated, struct mirdat *mdat, int logerr) |
|
939 | 939 |
{ |
940 | 940 |
struct cl_cvd *current, *remote; |
941 | 941 |
const struct cfgstruct *cpt; |
... | ... |
@@ -1013,7 +1013,7 @@ static int updatedb(const char *dbname, const char *hostname, char *ip, int *sig |
1013 | 1013 |
|
1014 | 1014 |
if(!nodb && !newver) { |
1015 | 1015 |
|
1016 |
- remote = remote_cvdhead(cvdfile, hostname, ip, localip, proxy, port, user, pass, uas, &ims, ctimeout, rtimeout, mdat); |
|
1016 |
+ remote = remote_cvdhead(cvdfile, hostname, ip, localip, proxy, port, user, pass, uas, &ims, ctimeout, rtimeout, mdat, logerr); |
|
1017 | 1017 |
|
1018 | 1018 |
if(!nodb && !ims) { |
1019 | 1019 |
logg("%s is up to date (version: %d, sigs: %d, f-level: %d, builder: %s)\n", localname, current->version, current->sigs, current->fl, current->builder); |
... | ... |
@@ -1078,7 +1078,7 @@ static int updatedb(const char *dbname, const char *hostname, char *ip, int *sig |
1078 | 1078 |
newfile = cli_gentemp(cwd); |
1079 | 1079 |
|
1080 | 1080 |
if(nodb) { |
1081 |
- ret = getcvd(cvdfile, newfile, hostname, ip, localip, proxy, port, user, pass, uas, nodb, newver, ctimeout, rtimeout, mdat); |
|
1081 |
+ ret = getcvd(cvdfile, newfile, hostname, ip, localip, proxy, port, user, pass, uas, nodb, newver, ctimeout, rtimeout, mdat, logerr); |
|
1082 | 1082 |
if(ret) { |
1083 | 1083 |
memset(ip, 0, 16); |
1084 | 1084 |
free(newfile); |
... | ... |
@@ -1093,7 +1093,10 @@ static int updatedb(const char *dbname, const char *hostname, char *ip, int *sig |
1093 | 1093 |
maxattempts = cfgopt(copt, "MaxAttempts")->numarg; |
1094 | 1094 |
for(i = currver + 1; i <= newver; i++) { |
1095 | 1095 |
for(j = 0; j < maxattempts; j++) { |
1096 |
- ret = getpatch(dbname, tmpdir, i, hostname, ip, localip, proxy, port, user, pass, uas, ctimeout, rtimeout, mdat); |
|
1096 |
+ int llogerr = logerr; |
|
1097 |
+ if(logerr) |
|
1098 |
+ llogerr = (j == maxattempts - 1); |
|
1099 |
+ ret = getpatch(dbname, tmpdir, i, hostname, ip, localip, proxy, port, user, pass, uas, ctimeout, rtimeout, mdat, llogerr); |
|
1097 | 1100 |
if(ret == 52 || ret == 58) { |
1098 | 1101 |
memset(ip, 0, 16); |
1099 | 1102 |
continue; |
... | ... |
@@ -1109,7 +1112,7 @@ static int updatedb(const char *dbname, const char *hostname, char *ip, int *sig |
1109 | 1109 |
cli_rmdirs(tmpdir); |
1110 | 1110 |
free(tmpdir); |
1111 | 1111 |
logg("^Incremental update failed, trying to download %s\n", cvdfile); |
1112 |
- ret = getcvd(cvdfile, newfile, hostname, ip, localip, proxy, port, user, pass, uas, 1, newver, ctimeout, rtimeout, mdat); |
|
1112 |
+ ret = getcvd(cvdfile, newfile, hostname, ip, localip, proxy, port, user, pass, uas, 1, newver, ctimeout, rtimeout, mdat, logerr); |
|
1113 | 1113 |
if(ret) { |
1114 | 1114 |
free(newfile); |
1115 | 1115 |
return ret; |
... | ... |
@@ -1164,7 +1167,7 @@ static int updatedb(const char *dbname, const char *hostname, char *ip, int *sig |
1164 | 1164 |
return 0; |
1165 | 1165 |
} |
1166 | 1166 |
|
1167 |
-int downloadmanager(const struct cfgstruct *copt, const struct optstruct *opt, const char *hostname, const char *dbdir) |
|
1167 |
+int downloadmanager(const struct cfgstruct *copt, const struct optstruct *opt, const char *hostname, const char *dbdir, int logerr) |
|
1168 | 1168 |
{ |
1169 | 1169 |
time_t currtime; |
1170 | 1170 |
int ret, updated = 0, outdated = 0, signo = 0; |
... | ... |
@@ -1263,7 +1266,7 @@ int downloadmanager(const struct cfgstruct *copt, const struct optstruct *opt, c |
1263 | 1263 |
|
1264 | 1264 |
memset(ipaddr, 0, sizeof(ipaddr)); |
1265 | 1265 |
|
1266 |
- if((ret = updatedb("main", hostname, ipaddr, &signo, copt, dnsreply, localip, outdated, &mdat)) > 50) { |
|
1266 |
+ if((ret = updatedb("main", hostname, ipaddr, &signo, copt, dnsreply, localip, outdated, &mdat, logerr)) > 50) { |
|
1267 | 1267 |
if(dnsreply) |
1268 | 1268 |
free(dnsreply); |
1269 | 1269 |
|
... | ... |
@@ -1277,7 +1280,7 @@ int downloadmanager(const struct cfgstruct *copt, const struct optstruct *opt, c |
1277 | 1277 |
updated = 1; |
1278 | 1278 |
|
1279 | 1279 |
/* if ipaddr[0] != 0 it will use it to connect to the web host */ |
1280 |
- if((ret = updatedb("daily", hostname, ipaddr, &signo, copt, dnsreply, localip, outdated, &mdat)) > 50) { |
|
1280 |
+ if((ret = updatedb("daily", hostname, ipaddr, &signo, copt, dnsreply, localip, outdated, &mdat, logerr)) > 50) { |
|
1281 | 1281 |
if(dnsreply) |
1282 | 1282 |
free(dnsreply); |
1283 | 1283 |
|
... | ... |
@@ -23,6 +23,6 @@ |
23 | 23 |
#include "shared/cfgparser.h" |
24 | 24 |
#include "shared/options.h" |
25 | 25 |
|
26 |
-int downloadmanager(const struct cfgstruct *copt, const struct optstruct *opt, const char *hostname, const char *dbdir); |
|
26 |
+int downloadmanager(const struct cfgstruct *copt, const struct optstruct *opt, const char *hostname, const char *dbdir, int logerr); |
|
27 | 27 |
|
28 | 28 |
#endif |
... | ... |
@@ -77,7 +77,7 @@ pthread_mutex_t logg_mutex = PTHREAD_MUTEX_INITIALIZER; |
77 | 77 |
|
78 | 78 |
FILE *logg_fd = NULL; |
79 | 79 |
|
80 |
-short int logg_verbose = 0, logg_lock = 1, logg_time = 0, logg_foreground = 1; |
|
80 |
+short int logg_verbose = 0, logg_nowarn = 0, logg_lock = 1, logg_time = 0, logg_foreground = 1; |
|
81 | 81 |
unsigned int logg_size = 0; |
82 | 82 |
const char *logg_file = NULL; |
83 | 83 |
#if defined(USE_SYSLOG) && !defined(C_AIX) |
... | ... |
@@ -85,7 +85,7 @@ short logg_syslog; |
85 | 85 |
#endif |
86 | 86 |
|
87 | 87 |
short int mprintf_disabled = 0, mprintf_verbose = 0, mprintf_quiet = 0, |
88 |
- mprintf_stdout = 0; |
|
88 |
+ mprintf_stdout = 0, mprintf_nowarn = 0; |
|
89 | 89 |
|
90 | 90 |
int mdprintf(int desc, const char *str, ...) |
91 | 91 |
{ |
... | ... |
@@ -202,8 +202,10 @@ int logg(const char *str, ...) |
202 | 202 |
fprintf(logg_fd, "ERROR: "); |
203 | 203 |
vfprintf(logg_fd, str + 1, args); |
204 | 204 |
} else if(*str == '^') { |
205 |
- fprintf(logg_fd, "WARNING: "); |
|
206 |
- vfprintf(logg_fd, str + 1, args); |
|
205 |
+ if(!logg_nowarn) { |
|
206 |
+ fprintf(logg_fd, "WARNING: "); |
|
207 |
+ vfprintf(logg_fd, str + 1, args); |
|
208 |
+ } |
|
207 | 209 |
} else if(*str == '*') { |
208 | 210 |
if(logg_verbose) |
209 | 211 |
vfprintf(logg_fd, str + 1, args); |
... | ... |
@@ -225,7 +227,8 @@ int logg(const char *str, ...) |
225 | 225 |
if(vbuff[0] == '!') { |
226 | 226 |
syslog(LOG_ERR, "%s", vbuff + 1); |
227 | 227 |
} else if(vbuff[0] == '^') { |
228 |
- syslog(LOG_WARNING, "%s", vbuff + 1); |
|
228 |
+ if(!logg_nowarn) |
|
229 |
+ syslog(LOG_WARNING, "%s", vbuff + 1); |
|
229 | 230 |
} else if(vbuff[0] == '*') { |
230 | 231 |
if(logg_verbose) { |
231 | 232 |
syslog(LOG_DEBUG, "%s", vbuff + 1); |
... | ... |
@@ -296,9 +299,11 @@ void mprintf(const char *str, ...) |
296 | 296 |
fprintf(fd, "ERROR: %s", &buff[1]); |
297 | 297 |
} else if(!mprintf_quiet) { |
298 | 298 |
if(buff[0] == '^') { |
299 |
- if(!mprintf_stdout) |
|
300 |
- fd = stderr; |
|
301 |
- fprintf(fd, "WARNING: %s", &buff[1]); |
|
299 |
+ if(!mprintf_nowarn) { |
|
300 |
+ if(!mprintf_stdout) |
|
301 |
+ fd = stderr; |
|
302 |
+ fprintf(fd, "WARNING: %s", &buff[1]); |
|
303 |
+ } |
|
302 | 304 |
} else if(buff[0] == '*') { |
303 | 305 |
if(mprintf_verbose) |
304 | 306 |
fprintf(fd, "%s", &buff[1]); |
... | ... |
@@ -35,7 +35,7 @@ int logg(const char *str, ...); |
35 | 35 |
#endif |
36 | 36 |
|
37 | 37 |
void logg_close(void); |
38 |
-extern short int logg_verbose, logg_lock, logg_time; |
|
38 |
+extern short int logg_verbose, logg_nowarn, logg_lock, logg_time; |
|
39 | 39 |
extern unsigned int logg_size; |
40 | 40 |
extern const char *logg_file; |
41 | 41 |
|
... | ... |
@@ -50,6 +50,6 @@ void mprintf(const char *str, ...) __attribute__((format(printf, 1, 2))); |
50 | 50 |
void mprintf(const char *str, ...); |
51 | 51 |
#endif |
52 | 52 |
|
53 |
-extern short int mprintf_disabled, mprintf_verbose, mprintf_quiet, mprintf_stdout; |
|
53 |
+extern short int mprintf_disabled, mprintf_verbose, mprintf_quiet, mprintf_nowarn, mprintf_stdout; |
|
54 | 54 |
|
55 | 55 |
#endif |