Ticket #73: fs.patch

File fs.patch, 1.0 KB (added by jackburton, 18 years ago)

Patch for fs.cpp which fixes the bug

Line 
1Index: src/build/libroot/fs.cpp
2===================================================================
3--- src/build/libroot/fs.cpp (revision 15691)
4+++ src/build/libroot/fs.cpp (working copy)
5 -312,6 +312,24 @@
6 // find the entry
7 bool found = false;
8 while (dirent *entry = readdir(dir)) {
9+ if ((!skipDot && strcmp(entry->d_name, ".") == 0)
10+ || strcmp(entry->d_name, "..") == 0) break;
11+ // skip "." and ".."
12+ string entryPath(path);
13+ entryPath += '/';
14+ entryPath += entry->d_name;
15+ entryPath += "/.";
16+ // old commented code below fails on mountpoints
17+ // this does get the correct inode by getting the inode of "path/name/."
18+ struct stat st;
19+ if (lstat(entryPath.c_str(), &st) == 0) {
20+ if (NodeRef(st) == ref) {
21+ name = entry->d_name;
22+ found = true;
23+ break;
24+ }
25+ }
26+/*
27 if ((!skipDot && strcmp(entry->d_name, ".") == 0)
28 || strcmp(entry->d_name, "..") == 0) {
29 // skip "." and ".."
30 -330,6 +348,7 @@
31 }
32 }
33 }
34+*/
35 }
36
37 if (!found)