From d0fa9efa5116200ed70805c5b77873c8b4cce647 Mon Sep 17 00:00:00 2001 From: Antonio SJ Musumeci Date: Thu, 6 Apr 2017 16:15:12 -0400 Subject: [PATCH] handle 32bit inode sizes --- src/fs_inode.hpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/fs_inode.hpp b/src/fs_inode.hpp index 683a83f0..fac1b814 100644 --- a/src/fs_inode.hpp +++ b/src/fs_inode.hpp @@ -19,6 +19,7 @@ #ifndef __FS_INODE_HPP__ #define __FS_INODE_HPP__ +#include #include namespace fs @@ -34,12 +35,10 @@ namespace fs void recompute(struct stat &st) { - /* - Some OSes have 32-bit device IDs, so box this up first. - This does also presume a 64-bit inode value. - */ - uint64_t st_dev = (uint64_t)st.st_dev; - st.st_ino |= (st_dev << 32); + if(sizeof(st.st_ino) == 4) + st.st_ino |= ((uint32_t)st.st_dev << 16); + else + st.st_ino |= ((uint64_t)st.st_dev << 32); } } }