Bug 1338086 - Remove useless else blocks in order to reduce complexity in security/sandbox/linux/ r?gcp
MozReview-Commit-ID: 5UWtAe6THd6
--- a/security/sandbox/linux/SandboxChroot.cpp
+++ b/security/sandbox/linux/SandboxChroot.cpp
@@ -44,27 +44,27 @@ SandboxChroot::~SandboxChroot()
bool
SandboxChroot::SendCommand(Command aComm)
{
MOZ_ALWAYS_ZERO(pthread_mutex_lock(&mMutex));
if (mCommand == NO_THREAD) {
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;
}
static void
AlwaysClose(int fd)
{
if (IGNORE_EINTR(close(fd)) != 0) {
SANDBOX_LOG_ERROR("close: %s", strerror(errno));
--- a/security/sandbox/linux/broker/SandboxBroker.cpp
+++ b/security/sandbox/linux/broker/SandboxBroker.cpp
@@ -406,17 +406,18 @@ DoStat(const char* aPath, void* aBuff, i
}
static int
DoLink(const char* aPath, const char* aPath2,
SandboxBrokerCommon::Operation aOper)
{
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");
}
size_t
SandboxBroker::ConvertToRealPath(char* aPath, size_t aBufSize, size_t aPathLen)
{