clamscan/manager.c: fix double-slash when scanning the root dir (bb#1263)

git-svn: trunk@4342
0.95
Tomasz Kojm 17 years ago
parent baacbd1676
commit 1464e7a169
  1. 4
      ChangeLog
  2. 10
      clamscan/manager.c

@ -1,3 +1,7 @@
Wed Nov 5 21:20:56 CET 2008 (tk)
---------------------------------
* clamscan/manager.c: fix double-slash when scanning the root dir (bb#1263)
Wed Nov 5 19:54:42 CET 2008 (tk)
---------------------------------
* 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
if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) {
/* build the full name */
fname = malloc(strlen(dirname) + strlen(dent->d_name) + 2);
sprintf(fname, "%s/%s", dirname, dent->d_name);
if(!strcmp(dirname, "/"))
sprintf(fname, "/%s", dent->d_name);
else
sprintf(fname, "%s/%s", dirname, dent->d_name);
/* stat the file */
if(lstat(fname, &statbuf) != -1) {
@ -619,12 +622,11 @@ int scanmanager(const struct optstruct *opt)
perror(file);
ret = 56;
} else {
int slash = 1;
for(i = strlen(file) - 1; i > 0 && slash; i--) {
for(i = strlen(file) - 1; i > 0; i--) {
if(file[i] == '/')
file[i] = 0;
else
slash = 0;
break;
}
fmode = (mode_t) fmodeint;

Loading…
Cancel
Save