Skip to content

Commit

Permalink
Merge pull request del-xiong#20 from del-xiong/del
Browse files Browse the repository at this point in the history
修复在某些linux系统由于dirent无法判断文件类型导致的加解密失败
  • Loading branch information
del-xiong authored May 9, 2019
2 parents 1b73418 + 7709d0f commit 085125c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tools/screw.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ void scanRoot(char *path)
int i;
int l = 0;
hP=opendir(path);
struct stat stat_buf;
if(hP == NULL)
return;
while (NULL != (dir=readdir(hP)))
Expand All @@ -75,14 +76,15 @@ void scanRoot(char *path)
memset(curPath,0,sizeof(curPath));
strcat(curPath,path);
strcat(curPath,dir->d_name);
if(dir->d_type == 4){
stat(curPath, &stat_buf);
// if it is a folder
if (S_ISDIR(stat_buf.st_mode)) {
if(curPath[l-1] != '/')
strcat(curPath,"/");
scanRoot(curPath);
}else
if(isPHP(dir->d_name) && dir->d_type == 8){
screw_work(curPath);
}
} else if (isPHP(dir->d_name)) {
screw_work(curPath);
}
}
}

Expand Down

0 comments on commit 085125c

Please sign in to comment.