summaryrefslogtreecommitdiff
path: root/zen/file_traverser.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:22:18 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:22:18 +0200
commitbcc5cc28c6dc5178e8f4fd0cc521034ae5def388 (patch)
treebacc60d27b435d32172f97643576c5e4e953177d /zen/file_traverser.cpp
parent5.9 (diff)
downloadFreeFileSync-bcc5cc28c6dc5178e8f4fd0cc521034ae5def388.tar.gz
FreeFileSync-bcc5cc28c6dc5178e8f4fd0cc521034ae5def388.tar.bz2
FreeFileSync-bcc5cc28c6dc5178e8f4fd0cc521034ae5def388.zip
5.10
Diffstat (limited to 'zen/file_traverser.cpp')
-rw-r--r--zen/file_traverser.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/zen/file_traverser.cpp b/zen/file_traverser.cpp
index a95f5dee..2cea74d8 100644
--- a/zen/file_traverser.cpp
+++ b/zen/file_traverser.cpp
@@ -547,7 +547,6 @@ private:
if (!dirEntry) //no more items or ignored error
return;
-
//don't return "." and ".."
const char* const shortName = dirEntry->d_name; //evaluate dirEntry *before* going into recursion => we use a single "buffer"!
if (shortName[0] == '.' &&
@@ -597,12 +596,12 @@ private:
if (const std::shared_ptr<TraverseCallback>& rv = sink.onDir(shortName, fullName))
traverse(fullName, *rv, level + 1);
}
- else //a file
+ else //a file or named pipe, ect.
{
TraverseCallback::FileInfo fileInfo;
fileInfo.fileSize = zen::UInt64(statDataTrg.st_size);
fileInfo.lastWriteTimeRaw = statDataTrg.st_mtime; //UTC time (time_t format); unit: 1 second
- //fileInfo.id = extractFileID(statDataTrg); -> id from dereferenced symlink is problematic, since renaming will consider the link, not the target!
+ //fileInfo.id = extractFileID(statDataTrg); -> id from dereferenced symlink is problematic, since renaming would consider the link, not the target!
sink.onFile(shortName, fullName, fileInfo);
}
}
@@ -619,7 +618,7 @@ private:
if (const std::shared_ptr<TraverseCallback>& rv = sink.onDir(shortName, fullName))
traverse(fullName, *rv, level + 1);
}
- else //a file
+ else //a file or named pipe, ect.
{
TraverseCallback::FileInfo fileInfo;
fileInfo.fileSize = zen::UInt64(statData.st_size);
@@ -628,6 +627,13 @@ private:
sink.onFile(shortName, fullName, fileInfo);
}
+ /*
+ It may be a good idea to not check "S_ISREG(statData.st_mode)" explicitly and to not issue an error message on other types to support these scenarios:
+ - RTS setup watch (essentially wants to read directories only)
+ - removeDirectory (wants to delete everything; pipes can be deleted just like files via "unlink")
+
+ However an "open" on a pipe will block (https://sourceforge.net/p/freefilesync/bugs/221/), so the copy routines need to be smarter!!
+ */
}
}
bgstack15