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

Side by Side Diff: sandbox/linux/services/credentials.cc

Issue 196073002: Move ScopedFILE to base namespace and scoped_file.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months 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 | Annotate | Revision Log
« no previous file with comments | « net/proxy/proxy_config_service_linux.cc ('k') | sql/connection_unittest.cc » ('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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "sandbox/linux/services/credentials.h" 5 #include "sandbox/linux/services/credentials.h"
6 6
7 #include <dirent.h> 7 #include <dirent.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <signal.h> 10 #include <signal.h>
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // Wrapper to manage the result from libcap2's cap_from_text(). 49 // Wrapper to manage the result from libcap2's cap_from_text().
50 typedef scoped_ptr<char, CapTextFreeDeleter> ScopedCapText; 50 typedef scoped_ptr<char, CapTextFreeDeleter> ScopedCapText;
51 51
52 struct FILECloser { 52 struct FILECloser {
53 inline void operator()(FILE* f) const { 53 inline void operator()(FILE* f) const {
54 DCHECK(f); 54 DCHECK(f);
55 PCHECK(0 == fclose(f)); 55 PCHECK(0 == fclose(f));
56 } 56 }
57 }; 57 };
58 58
59 // Don't use ScopedFILE in base/file_util.h since it doesn't check fclose(). 59 // Don't use ScopedFILE in base since it doesn't check fclose().
60 // TODO(jln): fix base/. 60 // TODO(jln): fix base/.
61 typedef scoped_ptr<FILE, FILECloser> ScopedFILE; 61 typedef scoped_ptr<FILE, FILECloser> ScopedFILE;
62 62
63 struct DIRCloser { 63 struct DIRCloser {
64 void operator()(DIR* d) const { 64 void operator()(DIR* d) const {
65 DCHECK(d); 65 DCHECK(d);
66 PCHECK(0 == closedir(d)); 66 PCHECK(0 == closedir(d));
67 } 67 }
68 }; 68 };
69 69
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 } 309 }
310 310
311 bool Credentials::DropFileSystemAccess() { 311 bool Credentials::DropFileSystemAccess() {
312 // Chrooting to a safe empty dir will only be safe if no directory file 312 // Chrooting to a safe empty dir will only be safe if no directory file
313 // descriptor is available to the process. 313 // descriptor is available to the process.
314 DCHECK(!HasOpenDirectory(-1)); 314 DCHECK(!HasOpenDirectory(-1));
315 return ChrootToSafeEmptyDir(); 315 return ChrootToSafeEmptyDir();
316 } 316 }
317 317
318 } // namespace sandbox. 318 } // namespace sandbox.
OLDNEW
« no previous file with comments | « net/proxy/proxy_config_service_linux.cc ('k') | sql/connection_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698