git-svn: trunk@4342
Tomasz Kojm authored on 2008/11/06 04:50:28... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Wed Nov 5 21:20:56 CET 2008 (tk) |
|
2 |
+--------------------------------- |
|
3 |
+ * clamscan/manager.c: fix double-slash when scanning the root dir (bb#1263) |
|
4 |
+ |
|
1 | 5 |
Wed Nov 5 19:54:42 CET 2008 (tk) |
2 | 6 |
--------------------------------- |
3 | 7 |
* unit_tests/virusaction-test.sh: ignore pathnames (bb#1274) |
... | ... |
@@ -242,7 +242,10 @@ static int scandirs(const char *dirname, struct cl_engine *engine, const struct |
242 | 242 |
if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) { |
243 | 243 |
/* build the full name */ |
244 | 244 |
fname = malloc(strlen(dirname) + strlen(dent->d_name) + 2); |
245 |
- sprintf(fname, "%s/%s", dirname, dent->d_name); |
|
245 |
+ if(!strcmp(dirname, "/")) |
|
246 |
+ sprintf(fname, "/%s", dent->d_name); |
|
247 |
+ else |
|
248 |
+ sprintf(fname, "%s/%s", dirname, dent->d_name); |
|
246 | 249 |
|
247 | 250 |
/* stat the file */ |
248 | 251 |
if(lstat(fname, &statbuf) != -1) { |
... | ... |
@@ -619,12 +622,11 @@ int scanmanager(const struct optstruct *opt) |
619 | 619 |
perror(file); |
620 | 620 |
ret = 56; |
621 | 621 |
} else { |
622 |
- int slash = 1; |
|
623 |
- for(i = strlen(file) - 1; i > 0 && slash; i--) { |
|
622 |
+ for(i = strlen(file) - 1; i > 0; i--) { |
|
624 | 623 |
if(file[i] == '/') |
625 | 624 |
file[i] = 0; |
626 | 625 |
else |
627 |
- slash = 0; |
|
626 |
+ break; |
|
628 | 627 |
} |
629 | 628 |
|
630 | 629 |
fmode = (mode_t) fmodeint; |