From: Mikko Rasa Date: Sun, 31 Jul 2011 15:37:29 +0000 (+0300) Subject: Don't throw on win32 if file has no owner or group X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=commitdiff_plain;h=e14321c38b34ec1cc5641b267f031693a8f7bc27 Don't throw on win32 if file has no owner or group --- 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);