| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/globals.h" | 5 #include "platform/globals.h" |
| 6 #if defined(HOST_OS_LINUX) | 6 #if defined(HOST_OS_LINUX) |
| 7 | 7 |
| 8 #include "bin/namespace.h" | 8 #include "bin/namespace.h" |
| 9 | 9 |
| 10 #include <errno.h> | 10 #include <errno.h> |
| 11 #include <fcntl.h> | 11 #include <fcntl.h> |
| 12 | 12 |
| 13 #include "bin/fdutils.h" | 13 #include "bin/fdutils.h" |
| 14 #include "bin/file.h" | 14 #include "bin/file.h" |
| 15 #include "platform/signal_blocker.h" | 15 #include "platform/signal_blocker.h" |
| 16 | 16 |
| 17 namespace dart { | 17 namespace dart { |
| 18 namespace bin { | 18 namespace bin { |
| 19 | 19 |
| 20 Namespace* Namespace::Create(const char* path) { | 20 Namespace* Namespace::Create(const char* path) { |
| 21 const intptr_t fd = TEMP_FAILURE_RETRY(open64(path, O_PATH)); | 21 const intptr_t fd = TEMP_FAILURE_RETRY(open64(path, O_DIRECTORY)); |
| 22 if (fd < 0) { | 22 if (fd < 0) { |
| 23 return NULL; | 23 return NULL; |
| 24 } | 24 } |
| 25 return new Namespace(fd); | 25 return new Namespace(fd); |
| 26 } | 26 } |
| 27 | 27 |
| 28 Namespace::~Namespace() { | 28 Namespace::~Namespace() { |
| 29 if (namespc_ != kNone) { | 29 if (namespc_ != kNone) { |
| 30 VOID_TEMP_FAILURE_RETRY(close(namespc_)); | 30 VOID_TEMP_FAILURE_RETRY(close(namespc_)); |
| 31 } | 31 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 NamespaceScope::~NamespaceScope() { | 94 NamespaceScope::~NamespaceScope() { |
| 95 if (owns_fd_) { | 95 if (owns_fd_) { |
| 96 FDUtils::SaveErrorAndClose(fd_); | 96 FDUtils::SaveErrorAndClose(fd_); |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 | 99 |
| 100 } // namespace bin | 100 } // namespace bin |
| 101 } // namespace dart | 101 } // namespace dart |
| 102 | 102 |
| 103 #endif // defined(HOST_OS_LINUX) | 103 #endif // defined(HOST_OS_LINUX) |
| OLD | NEW |