From 26e33a44ea2fe6c931016f8708666dd18cbb311f Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Sat, 15 Sep 2018 12:17:48 -0700 Subject: [PATCH] Fix getting current uid/gid in stat() on Windows --- src/cryfs/filesystem/CryNode.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/cryfs/filesystem/CryNode.cpp b/src/cryfs/filesystem/CryNode.cpp index e4e25ab4..b0760900 100644 --- a/src/cryfs/filesystem/CryNode.cpp +++ b/src/cryfs/filesystem/CryNode.cpp @@ -163,8 +163,14 @@ CryNode::stat_info CryNode::stat() const { stat_info result; //We are the root directory. //TODO What should we do? +#if defined(_MSC_VER) + // TODO And what to do on Windows? + result.uid = fspp::uid_t(1000); + result.gid = fspp::gid_t(1000); +#else result.uid = fspp::uid_t(getuid()); result.gid = fspp::gid_t(getgid()); +#endif result.mode = fspp::mode_t().addDirFlag().addUserReadFlag().addUserWriteFlag().addUserExecFlag(); result.size = fsblobstore::DirBlob::DIR_LSTAT_SIZE; //TODO If possible without performance loss, then for a directory, st_nlink should return number of dir entries (including "." and "..")