wrapCall(stat(path.c_str(), &fstat));
else
wrapCall(lstat(path.c_str(), &fstat));
+
+ // black magic - dmlite tests require proper count in st_nlink
+ if (S_ISDIR(fstat.st_mode)) {
+ Directory *dir;
+ struct dirent *entry;
+ int count = 0;
+
+ dir = openDir(path);
+ while ((entry = readDir(dir)) != NULL) {
+ if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0)
+ continue;
+ count++;
+ }
+ closeDir(dir);
+ fstat.st_nlink = count;
+ }
std::vector<std::string> components = Url::splitPath(path);
throw DmException(DMLITE_SYSERR(EFAULT),
"Tried to read a null directory");
- return static_cast<struct dirent*>(wrapCall(readdir(privateDir->dir)));
+ return static_cast<struct dirent*>(readdir(privateDir->dir));
}