I've received some curious results while using 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);
}
...
}
Results in:
Path is: /home/.../etc
Path is:
The only thing that would affect path
is opendir()
here. Does it have side effects that I'm not seeing? Or is there something else at work?