Commit 270c283c authored by jln@chromium.org's avatar jln@chromium.org

Correct style issues in Linux sandbox code.

NOTRY=true

Review URL: https://chromiumcodereview.appspot.com/10818015

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152123 0039d316-1c4b-4281-b951-d872f2087c98
parent b475ef4e
...@@ -39,11 +39,11 @@ void LogSandboxStarted(const std::string& sandbox_name) { ...@@ -39,11 +39,11 @@ void LogSandboxStarted(const std::string& sandbox_name) {
bool IsSeccompLegacyDesired() { bool IsSeccompLegacyDesired() {
#if defined(SECCOMP_SANDBOX) #if defined(SECCOMP_SANDBOX)
#if defined(NDEBUG) #if defined(NDEBUG)
// Off by default; allow turning on with a switch. // Off by default. Allow turning on with a switch.
return CommandLine::ForCurrentProcess()->HasSwitch( return CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableSeccompSandbox); switches::kEnableSeccompSandbox);
#else #else
// On by default; allow turning off with a switch. // On by default. Allow turning off with a switch.
return !CommandLine::ForCurrentProcess()->HasSwitch( return !CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableSeccompSandbox); switches::kDisableSeccompSandbox);
#endif // NDEBUG #endif // NDEBUG
......
...@@ -45,7 +45,7 @@ class LinuxSandbox { ...@@ -45,7 +45,7 @@ class LinuxSandbox {
// process type (this is for instance the case with the Zygote). // process type (this is for instance the case with the Zygote).
// In that case, it is crucial that PreinitializeSandboxFinish() gets // In that case, it is crucial that PreinitializeSandboxFinish() gets
// called for every child process. // called for every child process.
// TODO(markus,jln) we know this is not always done at the moment // TODO(markus, jln) we know this is not always done at the moment
// (crbug.com/139877). // (crbug.com/139877).
void PreinitializeSandbox(const std::string& process_type); void PreinitializeSandbox(const std::string& process_type);
// These should be called together. // These should be called together.
......
...@@ -28,8 +28,8 @@ void SetSandboxAPIEnvironmentVariable(base::Environment* env) { ...@@ -28,8 +28,8 @@ void SetSandboxAPIEnvironmentVariable(base::Environment* env) {
// Wrapper around a shared C function. // Wrapper around a shared C function.
// Returns the "saved" environment variable name corresponding to |envvar| // Returns the "saved" environment variable name corresponding to |envvar|
// in a new string or NULL. // in a new string or NULL.
std::string* CreateSavedVariableName(const char* envvar) { std::string* CreateSavedVariableName(const char* env_var) {
char* const saved_env_var = SandboxSavedEnvironmentVariable(envvar); char* const saved_env_var = SandboxSavedEnvironmentVariable(env_var);
if (!saved_env_var) if (!saved_env_var)
return NULL; return NULL;
std::string* saved_env_var_copy = new std::string(saved_env_var); std::string* saved_env_var_copy = new std::string(saved_env_var);
...@@ -44,7 +44,7 @@ std::string* CreateSavedVariableName(const char* envvar) { ...@@ -44,7 +44,7 @@ std::string* CreateSavedVariableName(const char* envvar) {
// renderer. // renderer.
void SaveSUIDUnsafeEnvironmentVariables(base::Environment* env) { void SaveSUIDUnsafeEnvironmentVariables(base::Environment* env) {
for (unsigned i = 0; kSUIDUnsafeEnvironmentVariables[i]; ++i) { for (unsigned i = 0; kSUIDUnsafeEnvironmentVariables[i]; ++i) {
const char* const env_var = kSUIDUnsafeEnvironmentVariables[i]; const char* env_var = kSUIDUnsafeEnvironmentVariables[i];
// Get the saved environment variable corresponding to envvar. // Get the saved environment variable corresponding to envvar.
scoped_ptr<std::string> saved_env_var(CreateSavedVariableName(env_var)); scoped_ptr<std::string> saved_env_var(CreateSavedVariableName(env_var));
if (saved_env_var == NULL) if (saved_env_var == NULL)
...@@ -113,14 +113,14 @@ SetuidSandboxClient::~SetuidSandboxClient() { ...@@ -113,14 +113,14 @@ SetuidSandboxClient::~SetuidSandboxClient() {
} }
bool SetuidSandboxClient::ChrootMe() { bool SetuidSandboxClient::ChrootMe() {
int fd = GetIPCDescriptor(env_); int ipc_fd = GetIPCDescriptor(env_);
if (fd < 0) { if (ipc_fd < 0) {
LOG(ERROR) << "Failed to obtain the sandbox IPC descriptor"; LOG(ERROR) << "Failed to obtain the sandbox IPC descriptor";
return false; return false;
} }
if (HANDLE_EINTR(write(fd, &kMsgChrootMe, 1)) != 1) { if (HANDLE_EINTR(write(ipc_fd, &kMsgChrootMe, 1)) != 1) {
PLOG(ERROR) << "Failed to write to chroot pipe"; PLOG(ERROR) << "Failed to write to chroot pipe";
return false; return false;
} }
...@@ -134,7 +134,7 @@ bool SetuidSandboxClient::ChrootMe() { ...@@ -134,7 +134,7 @@ bool SetuidSandboxClient::ChrootMe() {
} }
char reply; char reply;
if (HANDLE_EINTR(read(fd, &reply, 1)) != 1) { if (HANDLE_EINTR(read(ipc_fd, &reply, 1)) != 1) {
PLOG(ERROR) << "Failed to read from chroot pipe"; PLOG(ERROR) << "Failed to read from chroot pipe";
return false; return false;
} }
...@@ -176,3 +176,4 @@ void SetuidSandboxClient::SetupLaunchEnvironment() { ...@@ -176,3 +176,4 @@ void SetuidSandboxClient::SetupLaunchEnvironment() {
} }
} // namespace sandbox } // namespace sandbox
...@@ -56,3 +56,4 @@ class SetuidSandboxClient { ...@@ -56,3 +56,4 @@ class SetuidSandboxClient {
} // namespace sandbox } // namespace sandbox
#endif // SANDBOX_LINUX_SUID_SETUID_SANDBOX_CLIENT_H_ #endif // SANDBOX_LINUX_SUID_SETUID_SANDBOX_CLIENT_H_
...@@ -91,3 +91,4 @@ TEST(SetuidSandboxClient, SandboxedClientAPI) { ...@@ -91,3 +91,4 @@ TEST(SetuidSandboxClient, SandboxedClientAPI) {
} }
} // namespace sandbox } // namespace sandbox
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment