From e14321c38b34ec1cc5641b267f031693a8f7bc27 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 31 Jul 2011 18:37:29 +0300 Subject: [PATCH] Don't throw on win32 if file has no owner or group --- source/fs/stat.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/fs/stat.cpp b/source/fs/stat.cpp index 2419c29..d11867d 100644 --- a/source/fs/stat.cpp +++ b/source/fs/stat.cpp @@ -110,16 +110,18 @@ Stat Stat::stat(const Path &path) result.mtime = Time::TimeStamp(Time::filetime_to_rawtime(info.ftLastWriteTime)); PSECURITY_DESCRIPTOR sec_desc; - PSID owner; - PSID group; + PSID owner = 0; + PSID group = 0; if(!GetSecurityInfo(handle, SE_FILE_OBJECT, OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION, &owner, &group, 0, 0, &sec_desc)) { CloseHandle(handle); throw system_error("GetSecurityInfo"); } - result.owner = get_account_name(owner); - result.group = get_account_name(group); + if(owner) + result.owner = get_account_name(owner); + if(group) + result.group = get_account_name(group); LocalFree(sec_desc); -- 2.43.0