Browse code

improve error messages

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@1270 77e5149b-7576-45b1-b177-96237e5ba77b

Tomasz Kojm authored on 2005/01/25 04:15:30
Showing 3 changed files
... ...
@@ -1,3 +1,7 @@
1
+Mon Jan 24 20:12:06 CET 2005 (tk)
2
+---------------------------------
3
+  * freshclam: improve error messages (patch by Luca Gibelli <luca*clamav.net>)
4
+
1 5
 Mon Jan 24 17:54:14 CET 2005 (tk)
2 6
 ---------------------------------
3 7
   * clamd/thrmgr.c: unlock mutex if thread->state != POOL_VALID in
... ...
@@ -377,15 +377,19 @@ int download(const struct cfgstruct *copt, const struct optstruct *opt)
377 377
 
378 378
 	    if(ret == 52 || ret == 54 || ret == 58 || ret == 59) {
379 379
 		if(try < maxattempts - 1) {
380
-		    mprintf("Trying again...\n");
381
-		    logg("Trying again...\n");
380
+		    mprintf("Trying again in 5 secs...\n");
381
+		    logg("Trying again in 5 secs...\n");
382 382
 		    try++;
383
-		    sleep(1);
383
+		    sleep(5);
384 384
 		    continue;
385 385
 		} else {
386
-		    mprintf("Giving up...\n");
387
-		    logg("Giving up...\n");
386
+		    mprintf("Giving up on %s...\n", cpt->strarg);
387
+		    logg("Giving up on %s...\n", cpt->strarg);
388 388
 		    cpt = (struct cfgstruct *) cpt->nextarg;
389
+		    if(!cpt) {
390
+			mprintf("@Update failed. Your network may be down or none of the mirrors listed in freshclam.conf is working.\n");
391
+			logg("ERROR: Update failed. Your network may be down or none of the mirrors listed in freshclam.conf is working.\n");
392
+		    }
389 393
 		    try = 0;
390 394
 		}
391 395
 
... ...
@@ -274,7 +274,7 @@ int downloaddb(const char *localname, const char *remotename, const char *hostna
274 274
 	    hostfd = wwwconnect(hostname, proxy, port, ipaddr);
275 275
 
276 276
 	if(hostfd < 0) {
277
-	    mprintf("@Connection with %s failed.\n", hostname);
277
+            mprintf("@No servers could be reached. Giving up\n");
278 278
 	    if(current)
279 279
 		cl_cvdfree(current);
280 280
 	    return 52;
... ...
@@ -340,9 +340,9 @@ int downloaddb(const char *localname, const char *remotename, const char *hostna
340 340
 
341 341
     if(hostfd < 0) {
342 342
 	if(ipaddr[0])
343
-	    mprintf("@Connection with %s failed.\n", ipaddr);
343
+	    mprintf("Connection with %s failed.\n", ipaddr);
344 344
 	else
345
-	    mprintf("@Connection with %s failed.\n", hostname);
345
+	    mprintf("Connection with %s failed.\n", hostname);
346 346
 	return 52;
347 347
     };
348 348
 
... ...
@@ -476,7 +476,7 @@ int wwwconnect(const char *server, const char *proxy, int pport, char *ip)
476 476
 	name.sin_port = htons(port);
477 477
 
478 478
 	if(connect(socketfd, (struct sockaddr *) &name, sizeof(struct sockaddr_in)) == -1) {
479
-	    mprintf("@Can't connect to port %d of host %s (%s)\n", port, hostpt, ipaddr);
479
+	    mprintf("Can't connect to port %d of host %s (%s)\n", port, hostpt, ipaddr);
480 480
 	    continue;
481 481
 	}
482 482
 
... ...
@@ -484,7 +484,6 @@ int wwwconnect(const char *server, const char *proxy, int pport, char *ip)
484 484
     }
485 485
 
486 486
     close(socketfd);
487
-    mprintf("@No servers could be reached. Giving up\n");
488 487
     return -2;
489 488
 }
490 489