Browse code

freshdbdir() fixes

git-svn: trunk@3656

Tomasz Kojm authored on 2008/02/19 23:37:04
Showing 2 changed files
... ...
@@ -1,3 +1,9 @@
1
+Tue Feb 19 14:32:45 CET 2008 (tk)
2
+---------------------------------
3
+  * shared/misc.c: freshdbdir(): check freshclam.conf instead of clamd.conf;
4
+				 don't print any errors while checking
5
+				 alternative database directories
6
+
1 7
 Tue Feb 19 13:40:26 CET 2008 (tk)
2 8
 ---------------------------------
3 9
   * libclamav/scanners.c: only scan normalised text with type-7 sigs
... ...
@@ -67,7 +67,7 @@ char *freshdbdir(void)
67 67
 
68 68
     /* try to find fresh directory */
69 69
     dbdir = cl_retdbdir();
70
-    if((copt = getcfg(CONFDIR"/clamd.conf", 0))) {
70
+    if((copt = getcfg(CONFDIR"/freshclam.conf", 0))) {
71 71
 	if((cpt = cfgopt(copt, "DatabaseDirectory"))->enabled || (cpt = cfgopt(copt, "DataDirectory"))->enabled) {
72 72
 	    if(strcmp(dbdir, cpt->strarg)) {
73 73
 		    char *daily = (char *) malloc(strlen(cpt->strarg) + strlen(dbdir) + 30);
... ...
@@ -75,12 +75,12 @@ char *freshdbdir(void)
75 75
 		if(access(daily, R_OK))
76 76
 		    sprintf(daily, "%s/daily.cld", cpt->strarg);
77 77
 
78
-		if((d1 = cl_cvdhead(daily))) {
78
+		if(!access(daily, R_OK) && (d1 = cl_cvdhead(daily))) {
79 79
 		    sprintf(daily, "%s/daily.cvd", dbdir);
80 80
 		    if(access(daily, R_OK))
81 81
 			sprintf(daily, "%s/daily.cld", dbdir);
82 82
 
83
-		    if((d2 = cl_cvdhead(daily))) {
83
+		    if(!access(daily, R_OK) && (d2 = cl_cvdhead(daily))) {
84 84
 			free(daily);
85 85
 			if(d1->version > d2->version)
86 86
 			    dbdir = cpt->strarg;