Changeset 102187 in vbox for trunk/src/libs/xpcom18a4/xpcom/components/nsComponentManager.cpp
- Timestamp:
- Nov 21, 2023 10:50:09 AM (15 months ago)
- svn:sync-xref-src-repo-rev:
- 160312
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/xpcom/components/nsComponentManager.cpp
r102186 r102187 1038 1038 nsCOMPtr<nsILocalFile> localFile(do_QueryInterface(file)); 1039 1039 1040 rv = localFile->OpenNSPRFileDesc(PR_RDONLY, 0444, &fd); 1040 nsCAutoString pathName; 1041 rv = localFile->GetNativePath(pathName); 1041 1042 if (NS_FAILED(rv)) 1042 1043 return rv; 1043 1044 1044 PRInt64 fileSize; 1045 rv = localFile->GetFileSize(&fileSize); 1046 if (NS_FAILED(rv)) 1047 { 1048 PR_Close(fd); 1049 return rv; 1050 } 1051 1052 PRInt32 flen = nsInt64(fileSize); 1045 size_t cbRead = 0; 1046 RTFILE hFile = NIL_RTFILE; 1047 int vrc = RTFileOpen(&hFile, pathName.get(), 1048 RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_NONE); 1049 if (RT_FAILURE(vrc)) 1050 return NS_ERROR_FAILURE; 1051 1052 uint64_t fileSize; 1053 vrc = RTFileQuerySize(hFile, &fileSize); 1054 if (RT_FAILURE(vrc)) 1055 { 1056 RTFileClose(hFile); 1057 return NS_ERROR_FAILURE; 1058 } 1059 1060 PRInt32 flen = nsInt64((int64_t)fileSize); 1053 1061 if (flen == 0) 1054 1062 { 1055 PR_Close(fd);1063 RTFileClose(hFile); 1056 1064 NS_WARNING("Persistent Registry Empty!"); 1057 1065 return NS_OK; // ERROR CONDITION … … 1062 1070 goto out; 1063 1071 1064 if (flen > PR_Read(fd, registry, flen)) 1072 vrc = RTFileRead(hFile, registry, flen, &cbRead); 1073 if (RT_FAILURE(vrc) || cbRead < flen) 1065 1074 { 1066 1075 rv = NS_ERROR_FAILURE; … … 1267 1276 mRegistryDirty = PR_FALSE; 1268 1277 out: 1269 if ( fd)1270 PR_Close(fd);1278 if (hFile != NIL_RTFILE) 1279 RTFileClose(hFile); 1271 1280 1272 1281 if (registry)
Note:
See TracChangeset
for help on using the changeset viewer.