Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: base/files/scoped_file.cc

Issue 1549853002: Switch to standard integer types in base/files/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/files/memory_mapped_file_win.cc ('k') | base/files/scoped_temp_dir.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/files/scoped_file.h" 5 #include "base/files/scoped_file.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "build/build_config.h"
8 9
9 #if defined(OS_POSIX) 10 #if defined(OS_POSIX)
10 #include <unistd.h> 11 #include <unistd.h>
11 12
12 #include "base/posix/eintr_wrapper.h" 13 #include "base/posix/eintr_wrapper.h"
13 #endif 14 #endif
14 15
15 namespace base { 16 namespace base {
16 namespace internal { 17 namespace internal {
17 18
18 #if defined(OS_POSIX) 19 #if defined(OS_POSIX)
19 20
20 // static 21 // static
21 void ScopedFDCloseTraits::Free(int fd) { 22 void ScopedFDCloseTraits::Free(int fd) {
22 // It's important to crash here. 23 // It's important to crash here.
23 // There are security implications to not closing a file descriptor 24 // There are security implications to not closing a file descriptor
24 // properly. As file descriptors are "capabilities", keeping them open 25 // properly. As file descriptors are "capabilities", keeping them open
25 // would make the current process keep access to a resource. Much of 26 // would make the current process keep access to a resource. Much of
26 // Chrome relies on being able to "drop" such access. 27 // Chrome relies on being able to "drop" such access.
27 // It's especially problematic on Linux with the setuid sandbox, where 28 // It's especially problematic on Linux with the setuid sandbox, where
28 // a single open directory would bypass the entire security model. 29 // a single open directory would bypass the entire security model.
29 PCHECK(0 == IGNORE_EINTR(close(fd))); 30 PCHECK(0 == IGNORE_EINTR(close(fd)));
30 } 31 }
31 32
32 #endif // OS_POSIX 33 #endif // OS_POSIX
33 34
34 } // namespace internal 35 } // namespace internal
35 } // namespace base 36 } // namespace base
OLDNEW
« no previous file with comments | « base/files/memory_mapped_file_win.cc ('k') | base/files/scoped_temp_dir.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698