OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/file_util.h" | 5 #include "base/file_util.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 <fnmatch.h> | 10 #include <fnmatch.h> |
(...skipping 20 matching lines...) Expand all Loading... |
31 #endif | 31 #endif |
32 | 32 |
33 #include <fstream> | 33 #include <fstream> |
34 | 34 |
35 #include "base/basictypes.h" | 35 #include "base/basictypes.h" |
36 #include "base/eintr_wrapper.h" | 36 #include "base/eintr_wrapper.h" |
37 #include "base/file_path.h" | 37 #include "base/file_path.h" |
38 #include "base/logging.h" | 38 #include "base/logging.h" |
39 #include "base/memory/scoped_ptr.h" | 39 #include "base/memory/scoped_ptr.h" |
40 #include "base/memory/singleton.h" | 40 #include "base/memory/singleton.h" |
| 41 #include "base/path_service.h" |
41 #include "base/stl_util.h" | 42 #include "base/stl_util.h" |
42 #include "base/string_util.h" | 43 #include "base/string_util.h" |
43 #include "base/stringprintf.h" | 44 #include "base/stringprintf.h" |
44 #include "base/sys_string_conversions.h" | 45 #include "base/sys_string_conversions.h" |
45 #include "base/threading/thread_restrictions.h" | 46 #include "base/threading/thread_restrictions.h" |
46 #include "base/time.h" | 47 #include "base/time.h" |
47 #include "base/utf_string_conversions.h" | 48 #include "base/utf_string_conversions.h" |
48 | 49 |
49 #if defined(OS_ANDROID) | 50 #if defined(OS_ANDROID) |
50 #include "base/os_compat_android.h" | 51 #include "base/os_compat_android.h" |
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 return true; | 914 return true; |
914 } | 915 } |
915 | 916 |
916 #if !defined(OS_MACOSX) | 917 #if !defined(OS_MACOSX) |
917 bool GetTempDir(FilePath* path) { | 918 bool GetTempDir(FilePath* path) { |
918 const char* tmp = getenv("TMPDIR"); | 919 const char* tmp = getenv("TMPDIR"); |
919 if (tmp) | 920 if (tmp) |
920 *path = FilePath(tmp); | 921 *path = FilePath(tmp); |
921 else | 922 else |
922 #if defined(OS_ANDROID) | 923 #if defined(OS_ANDROID) |
923 *path = FilePath("/data/local/tmp"); | 924 return PathService::Get(base::DIR_CACHE, path); |
924 #else | 925 #else |
925 *path = FilePath("/tmp"); | 926 *path = FilePath("/tmp"); |
926 #endif | 927 #endif |
927 return true; | 928 return true; |
928 } | 929 } |
929 | 930 |
930 #if !defined(OS_ANDROID) | 931 #if !defined(OS_ANDROID) |
931 | 932 |
932 #if defined(OS_LINUX) | 933 #if defined(OS_LINUX) |
933 // Determine if /dev/shm files can be mapped and then mprotect'd PROT_EXEC. | 934 // Determine if /dev/shm files can be mapped and then mprotect'd PROT_EXEC. |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1114 | 1115 |
1115 allowed_group_ids.insert(group_record->gr_gid); | 1116 allowed_group_ids.insert(group_record->gr_gid); |
1116 } | 1117 } |
1117 | 1118 |
1118 return VerifyPathControlledByUser( | 1119 return VerifyPathControlledByUser( |
1119 kFileSystemRoot, path, kRootUid, allowed_group_ids); | 1120 kFileSystemRoot, path, kRootUid, allowed_group_ids); |
1120 } | 1121 } |
1121 #endif // defined(OS_MACOSX) | 1122 #endif // defined(OS_MACOSX) |
1122 | 1123 |
1123 } // namespace file_util | 1124 } // namespace file_util |
OLD | NEW |