]> git.tdb.fi Git - libs/core.git/commitdiff
Don't throw on win32 if file has no owner or group
authorMikko Rasa <tdb@tdb.fi>
Sun, 31 Jul 2011 15:37:29 +0000 (18:37 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 31 Jul 2011 15:37:29 +0000 (18:37 +0300)
source/fs/stat.cpp

index 2419c2990c9bd9353f06e1ddcaf481afae6bb03e..d11867d99b6af41a427dba423673acc622390a65 100644 (file)
@@ -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);