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 "sandbox/linux/services/broker_process.h" | 5 #include "sandbox/linux/services/broker_process.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
(...skipping 30 matching lines...) Expand all Loading... |
41 static const char file_template[] = "/tmp/ScopedTempFileXXXXXX"; | 41 static const char file_template[] = "/tmp/ScopedTempFileXXXXXX"; |
42 #endif // defined(OS_ANDROID) | 42 #endif // defined(OS_ANDROID) |
43 COMPILE_ASSERT(sizeof(full_file_name_) >= sizeof(file_template), | 43 COMPILE_ASSERT(sizeof(full_file_name_) >= sizeof(file_template), |
44 full_file_name_is_large_enough); | 44 full_file_name_is_large_enough); |
45 memcpy(full_file_name_, file_template, sizeof(file_template)); | 45 memcpy(full_file_name_, file_template, sizeof(file_template)); |
46 fd_ = mkstemp(full_file_name_); | 46 fd_ = mkstemp(full_file_name_); |
47 CHECK_LE(0, fd_); | 47 CHECK_LE(0, fd_); |
48 } | 48 } |
49 ~ScopedTemporaryFile() { | 49 ~ScopedTemporaryFile() { |
50 CHECK_EQ(0, unlink(full_file_name_)); | 50 CHECK_EQ(0, unlink(full_file_name_)); |
51 CHECK_EQ(0, HANDLE_EINTR(close(fd_))); | 51 CHECK_EQ(0, IGNORE_EINTR(close(fd_))); |
52 } | 52 } |
53 | 53 |
54 int fd() const { return fd_; } | 54 int fd() const { return fd_; } |
55 const char* full_file_name() const { return full_file_name_; } | 55 const char* full_file_name() const { return full_file_name_; } |
56 | 56 |
57 private: | 57 private: |
58 int fd_; | 58 int fd_; |
59 char full_file_name_[128]; | 59 char full_file_name_[128]; |
60 DISALLOW_COPY_AND_ASSIGN(ScopedTemporaryFile); | 60 DISALLOW_COPY_AND_ASSIGN(ScopedTemporaryFile); |
61 }; | 61 }; |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 // expected. | 435 // expected. |
436 } | 436 } |
437 | 437 |
438 TEST(BrokerProcess, OpenComplexFlagsNoClientCheck) { | 438 TEST(BrokerProcess, OpenComplexFlagsNoClientCheck) { |
439 TestOpenComplexFlags(false /* fast_check_in_client */); | 439 TestOpenComplexFlags(false /* fast_check_in_client */); |
440 // Don't do anything here, so that ASSERT works in the subfunction as | 440 // Don't do anything here, so that ASSERT works in the subfunction as |
441 // expected. | 441 // expected. |
442 } | 442 } |
443 | 443 |
444 } // namespace sandbox | 444 } // namespace sandbox |
OLD | NEW |