diff --git a/dom/ipc/MemMapSnapshot.cpp b/dom/ipc/MemMapSnapshot.cpp index 866767071521..5552f6161a38 100644 --- a/dom/ipc/MemMapSnapshot.cpp +++ b/dom/ipc/MemMapSnapshot.cpp @@ -118,19 +118,7 @@ MemMapSnapshot::Freeze(AutoMemMap& aMem) MOZ_TRY(NS_NewNativeLocalFile(mPath, /* followLinks = */ false, getter_AddRefs(file))); - auto result = aMem.init(file); -#ifdef XP_LINUX - // On Linux automation runs, every few hundred thousand calls, our attempt to - // stat the file that we just successfully opened fails with EBADF (bug - // 1472889). Presumably this is a race with a background thread that double - // closes a file, but is difficult to diagnose, so work around it by making a - // second mapping attempt if the first one fails. - if (!result.isOk()) { - aMem.reset(); - result = aMem.init(file); - } -#endif - return result; + return aMem.init(file); } #else diff --git a/widget/LSBUtils.cpp b/widget/LSBUtils.cpp index 344fea4d0b67..1b0b2bdc183e 100644 --- a/widget/LSBUtils.cpp +++ b/widget/LSBUtils.cpp @@ -8,6 +8,7 @@ #include #include "base/process_util.h" +#include "mozilla/FileUtils.h" namespace mozilla { namespace widget { @@ -47,7 +48,7 @@ GetLSBRelease(nsACString& aDistributor, return false; } - FILE* stream = fdopen(pipefd[0], "r"); + ScopedCloseFile stream(fdopen(pipefd[0], "r")); if (!stream) { NS_WARNING("Could not wrap fd!"); close(pipefd[0]); @@ -62,12 +63,8 @@ GetLSBRelease(nsACString& aDistributor, dist, desc, release, codename) != 4) { NS_WARNING("Failed to parse lsb_release!"); - fclose(stream); - close(pipefd[0]); return false; } - fclose(stream); - close(pipefd[0]); aDistributor.Assign(dist); aDescription.Assign(desc);