From 455bdf24fe64e6d32f4260a0ddb9b76e0b3214b0 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 9 Feb 2017 10:56:05 +0100 Subject: [PATCH] Bug 1338086 - Remove useless else blocks in order to reduce complexity in security/sandbox/linux/ r=gcp MozReview-Commit-ID: 5UWtAe6THd6 --HG-- extra : rebase_source : 17af6640439f209cb37e91552cf0f97043bd9e91 --- security/sandbox/linux/SandboxChroot.cpp | 20 +++++++++---------- .../sandbox/linux/broker/SandboxBroker.cpp | 3 ++- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/security/sandbox/linux/SandboxChroot.cpp b/security/sandbox/linux/SandboxChroot.cpp index 2091bfe05ccd..d1eba0543644 100644 --- a/security/sandbox/linux/SandboxChroot.cpp +++ b/security/sandbox/linux/SandboxChroot.cpp @@ -49,17 +49,17 @@ SandboxChroot::SendCommand(Command aComm) MOZ_RELEASE_ASSERT(aComm == JUST_EXIT); MOZ_ALWAYS_ZERO(pthread_mutex_unlock(&mMutex)); return false; - } else { - MOZ_ASSERT(mCommand == NO_COMMAND); - mCommand = aComm; - MOZ_ALWAYS_ZERO(pthread_mutex_unlock(&mMutex)); - MOZ_ALWAYS_ZERO(pthread_cond_signal(&mWakeup)); - void *retval; - if (pthread_join(mThread, &retval) != 0 || retval != nullptr) { - MOZ_CRASH("Failed to stop privileged chroot thread"); - } - MOZ_ASSERT(mCommand == NO_THREAD); } + MOZ_ASSERT(mCommand == NO_COMMAND); + mCommand = aComm; + MOZ_ALWAYS_ZERO(pthread_mutex_unlock(&mMutex)); + MOZ_ALWAYS_ZERO(pthread_cond_signal(&mWakeup)); + void *retval; + if (pthread_join(mThread, &retval) != 0 || retval != nullptr) { + MOZ_CRASH("Failed to stop privileged chroot thread"); + } + MOZ_ASSERT(mCommand == NO_THREAD); + return true; } diff --git a/security/sandbox/linux/broker/SandboxBroker.cpp b/security/sandbox/linux/broker/SandboxBroker.cpp index e90e670c56e5..daa1fce1de04 100644 --- a/security/sandbox/linux/broker/SandboxBroker.cpp +++ b/security/sandbox/linux/broker/SandboxBroker.cpp @@ -411,7 +411,8 @@ DoLink(const char* aPath, const char* aPath2, { if (aOper == SandboxBrokerCommon::Operation::SANDBOX_FILE_LINK) { return link(aPath, aPath2); - } else if (aOper == SandboxBrokerCommon::Operation::SANDBOX_FILE_SYMLINK) { + } + if (aOper == SandboxBrokerCommon::Operation::SANDBOX_FILE_SYMLINK) { return symlink(aPath, aPath2); } MOZ_CRASH("SandboxBroker: Unknown link operation");