Fix getting current uid/gid in stat() on Windows

This commit is contained in:
Sebastian Messmer 2018-09-15 12:17:48 -07:00
parent b1dfd94243
commit 26e33a44ea

View File

@ -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 "..")