summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2017-04-06 09:58:25 +0200
committerMax Kellermann <max@musicpd.org>2017-04-06 09:58:25 +0200
commit504f5f7bddd81d3b02d00255f5ce693352ca836b (patch)
tree6e4550c68ea604d7cfcc2806509257a331d5dc5e
parent32bcad51b89d024cab47fc3670b30dc7fed57479 (diff)
storage/FileInfo, db/simple/Directory: use 64 bit for device/inode
An ino_t is usually a 64 bit integer, and some file systems (such as Linux's kernel NFS client) really uses the upper 32 bit. This can lead to false positives in the directory loop detection in FindAncestorLoop(). Increasing these two attributes (in StorageFileInfo and Directory) to 64 bit adds little overhead, but makes the check a lot safer.
-rw-r--r--NEWS2
-rw-r--r--src/db/plugins/simple/Directory.hxx2
-rw-r--r--src/storage/FileInfo.hxx2
3 files changed, 4 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index a7b441c6f..c57c9dca3 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,6 @@
ver 0.20.7 (not yet released)
+* database
+ - simple: fix false positive directory loop detection with NFS
ver 0.20.6 (2017/03/10)
* input
diff --git a/src/db/plugins/simple/Directory.hxx b/src/db/plugins/simple/Directory.hxx
index ee720108c..15631a091 100644
--- a/src/db/plugins/simple/Directory.hxx
+++ b/src/db/plugins/simple/Directory.hxx
@@ -86,7 +86,7 @@ struct Directory {
Directory *parent;
time_t mtime;
- unsigned inode, device;
+ uint64_t inode, device;
std::string path;
diff --git a/src/storage/FileInfo.hxx b/src/storage/FileInfo.hxx
index a69b47f0d..7a5cdca73 100644
--- a/src/storage/FileInfo.hxx
+++ b/src/storage/FileInfo.hxx
@@ -48,7 +48,7 @@ struct StorageFileInfo {
* Device id and inode number. 0 means unknown / not
* applicable.
*/
- unsigned device, inode;
+ uint64_t device, inode;
constexpr bool IsRegular() const {
return type == Type::REGULAR;