| Index: runtime/bin/directory_openbsd.cc
|
| diff --git a/runtime/bin/directory_macos.cc b/runtime/bin/directory_openbsd.cc
|
| similarity index 98%
|
| copy from runtime/bin/directory_macos.cc
|
| copy to runtime/bin/directory_openbsd.cc
|
| index 55994aa79abdd26998d52d5f3a4de0f706bd918a..2ef33a3a7622105883ecad57470e0aec5632fe6c 100644
|
| --- a/runtime/bin/directory_macos.cc
|
| +++ b/runtime/bin/directory_openbsd.cc
|
| @@ -3,7 +3,7 @@
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| #include "platform/globals.h"
|
| -#if defined(TARGET_OS_MACOS)
|
| +#if defined(TARGET_OS_OPENBSD)
|
|
|
| #include "bin/directory.h"
|
|
|
| @@ -28,20 +28,24 @@ PathBuffer::PathBuffer() : length_(0) {
|
| data_ = calloc(PATH_MAX + 1, sizeof(char)); // NOLINT
|
| }
|
|
|
| +
|
| bool PathBuffer::AddW(const wchar_t* name) {
|
| UNREACHABLE();
|
| return false;
|
| }
|
|
|
| +
|
| char* PathBuffer::AsString() const {
|
| return reinterpret_cast<char*>(data_);
|
| }
|
|
|
| +
|
| wchar_t* PathBuffer::AsStringW() const {
|
| UNREACHABLE();
|
| return NULL;
|
| }
|
|
|
| +
|
| bool PathBuffer::Add(const char* name) {
|
| char* data = AsString();
|
| int written = snprintf(data + length_,
|
| @@ -51,7 +55,7 @@ bool PathBuffer::Add(const char* name) {
|
| data[PATH_MAX] = '\0';
|
| if (written <= PATH_MAX - length_ &&
|
| written >= 0 &&
|
| - static_cast<size_t>(written) == strlen(name)) {
|
| + static_cast<size_t>(written) == strnlen(name, PATH_MAX + 1)) {
|
| length_ += written;
|
| return true;
|
| } else {
|
| @@ -60,6 +64,7 @@ bool PathBuffer::Add(const char* name) {
|
| }
|
| }
|
|
|
| +
|
| void PathBuffer::Reset(int new_length) {
|
| length_ = new_length;
|
| AsString()[length_] = '\0';
|
| @@ -431,4 +436,4 @@ bool Directory::Rename(const char* path, const char* new_path) {
|
| } // namespace bin
|
| } // namespace dart
|
|
|
| -#endif // defined(TARGET_OS_MACOS)
|
| +#endif // defined(TARGET_OS_OPENBSD)
|
|
|