diff options
author | Moonchild <moonchild@palemoon.org> | 2022-05-09 22:38:16 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2022-05-09 22:38:16 +0000 |
commit | 9edf1b7bea5ff893f88911fc1a6a2dca3faeece9 (patch) | |
tree | 98bd9b0c7e3ca3e517e9e43dea157707b13f6bdb /modules/libjar/nsZipArchive.cpp | |
parent | 930ddd693be251c86ee904dafbaef38234b692c0 (diff) | |
download | uxp-9edf1b7bea5ff893f88911fc1a6a2dca3faeece9.tar.gz |
Issue #1896 - Port GetNativePath changes from GRE.getnativepath-work
Diffstat (limited to 'modules/libjar/nsZipArchive.cpp')
-rw-r--r-- | modules/libjar/nsZipArchive.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/modules/libjar/nsZipArchive.cpp b/modules/libjar/nsZipArchive.cpp index b28fddc181..8006ee56c0 100644 --- a/modules/libjar/nsZipArchive.cpp +++ b/modules/libjar/nsZipArchive.cpp @@ -486,7 +486,7 @@ MOZ_WIN_MEM_TRY_CATCH(return nullptr) // On extraction error(s) it removes the file. // When needed, it also resolves the symlink. //--------------------------------------------- -nsresult nsZipArchive::ExtractFile(nsZipItem *item, const char *outname, +nsresult nsZipArchive::ExtractFile(nsZipItem *item, nsIFile* outFile, PRFileDesc* aFd) { if (!item) @@ -524,11 +524,16 @@ nsresult nsZipArchive::ExtractFile(nsZipItem *item, const char *outname, //-- delete the file on errors, or resolve symlink if needed if (aFd) { PR_Close(aFd); - if (rv != NS_OK) - PR_Delete(outname); + if (NS_FAILED(rv) && outFile) { + outFile->Remove(false); + } #ifdef XP_UNIX - else if (item->IsSymlink()) - rv = ResolveSymlink(outname); + else if (item->IsSymlink()) { + nsAutoCString path; + rv = outFile->GetNativePath(path); + if (NS_FAILED(rv)) return rv; + rv = ResolveSymlink(path.get()); + } #endif } |