使用中にいくつかの奇妙な結果を受け取りましたopendir()
:
int dtw(char *path) {
struct stat statbuf;
...
else if (S_ISDIR(statbuf.st_mode)) {
printf("Path is: %s\n", path);
struct dirent *dirent;
DIR *dirp;
if ((dirp = opendir(path)) == NULL) {
puts("Can't open directory.");
return -1;
}
printf("Path is: %s\n", path);
}
...
}
結果:
Path is: /home/.../etc
Path is:
影響するのpath
はopendir()
ここだけです。私が見ない副作用はありますか?それとも他に何か仕事がありますか?