Chromium Code Reviews| 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..d4bfe6a3f82abfe66404761c2b554d9b8e25ed84 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" |
| @@ -51,7 +51,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 { |
| @@ -364,7 +364,6 @@ bool Directory::Create(const char* dir_name) { |
| return (result == 0); |
| } |
| - |
|
Ivan Posva
2016/01/11 23:58:40
Why? Generally we use two lines between functions.
mulander
2016/01/12 00:22:45
I was not aware of that. Will be fixed.
|
| char* Directory::SystemTemp() { |
| const char* temp_dir = getenv("TMPDIR"); |
| if (temp_dir == NULL) { |
| @@ -382,7 +381,6 @@ char* Directory::SystemTemp() { |
| return result; |
| } |
| - |
|
Ivan Posva
2016/01/11 23:58:40
ditto
mulander
2016/01/12 00:22:45
Acknowledged.
|
| char* Directory::CreateTemp(const char* prefix) { |
| // Returns a new, unused directory name, adding characters to the end |
| // of prefix. Creates the directory with the permissions specified |
| @@ -431,4 +429,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) |