diff options
-rw-r--r-- | netfs/ice/typeConverter.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/netfs/ice/typeConverter.cpp b/netfs/ice/typeConverter.cpp index 5f3b668..90fa439 100644 --- a/netfs/ice/typeConverter.cpp +++ b/netfs/ice/typeConverter.cpp @@ -7,9 +7,10 @@ struct stat EntryTypeConverter::convert(const NetFS::Attr & a) const { auto map = mapper->mapTransport(a.uid, a.gid); - struct stat s { }; + struct stat s {}; + static_assert(sizeof(s.st_ino) == sizeof(a.inode)); s.st_dev = safe {a.dev}; - s.st_ino = safe {a.inode}; + std::memcpy(&s.st_ino, &a.inode, sizeof(s.st_ino)); s.st_mode = safe {a.mode & ~map.mask}; s.st_nlink = safe {a.links}; s.st_uid = safe {map.uid}; @@ -27,7 +28,7 @@ EntryTypeConverter::convert(const NetFS::Attr & a) const struct statvfs TypeConverter::convert(const NetFS::VFS & v) const { - struct statvfs vfs { }; + struct statvfs vfs {}; vfs.f_bsize = safe {v.blockSize}; vfs.f_frsize = safe {v.fragmentSize}; vfs.f_blocks = safe {v.blocks}; @@ -46,8 +47,9 @@ EntryTypeConverter::convert(const struct stat & s) const { auto map = mapper->mapFileSystem(safe {s.st_uid}, safe {s.st_gid}); NetFS::Attr a {}; + static_assert(sizeof(s.st_ino) == sizeof(a.inode)); a.dev = safe {s.st_dev}; - a.inode = safe {s.st_ino}; + std::memcpy(&a.inode, &s.st_ino, sizeof(a.inode)); a.mode = safe {s.st_mode & static_cast<decltype(s.st_mode)>(~map.mask)}; a.links = safe {s.st_nlink}; a.uid = std::move(map.username); |