summaryrefslogtreecommitdiffstats
path: root/sandbox/linux/services/yama.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/linux/services/yama.cc')
-rw-r--r--sandbox/linux/services/yama.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/sandbox/linux/services/yama.cc b/sandbox/linux/services/yama.cc
index efb261c..39ac079 100644
--- a/sandbox/linux/services/yama.cc
+++ b/sandbox/linux/services/yama.cc
@@ -12,6 +12,7 @@
#include "base/basictypes.h"
#include "base/file_util.h"
+#include "base/files/scoped_file.h"
#include "base/logging.h"
#include "base/posix/eintr_wrapper.h"
@@ -78,18 +79,17 @@ int Yama::GetStatus() {
static const char kPtraceScopePath[] = "/proc/sys/kernel/yama/ptrace_scope";
- int yama_scope = open(kPtraceScopePath, O_RDONLY);
+ base::ScopedFD yama_scope(open(kPtraceScopePath, O_RDONLY));
- if (yama_scope < 0) {
+ if (!yama_scope.is_valid()) {
const int open_errno = errno;
DCHECK(ENOENT == open_errno);
// The status is known, yama is not present.
return STATUS_KNOWN;
}
- file_util::ScopedFDCloser yama_scope_closer(&yama_scope);
char yama_scope_value = 0;
- ssize_t num_read = read(yama_scope, &yama_scope_value, 1);
+ ssize_t num_read = read(yama_scope.get(), &yama_scope_value, 1);
PCHECK(1 == num_read);
switch (yama_scope_value) {