diff options
Diffstat (limited to 'lldb/source/Host/windows/Windows.cpp')
| -rw-r--r-- | lldb/source/Host/windows/Windows.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lldb/source/Host/windows/Windows.cpp b/lldb/source/Host/windows/Windows.cpp index cb69a9cb3e4..b8ee8b2a65e 100644 --- a/lldb/source/Host/windows/Windows.cpp +++ b/lldb/source/Host/windows/Windows.cpp @@ -20,6 +20,13 @@ #include <cerrno> #include <ctype.h> +// These prototypes are defined in <direct.h>, but it also defines chdir() and getcwd(), giving multiply defined errors +extern "C" +{ + char *_getcwd(char *buffer, int maxlen); + int _chdir(const char *path); +} + int vasprintf(char **ret, const char *fmt, va_list ap) { char *buf; @@ -157,11 +164,16 @@ char* basename(char *path) return &l1[1]; } +// use _getcwd() instead of GetCurrentDirectory() because it updates errno char* getcwd(char* path, int max) { - if (GetCurrentDirectory(max, path) == 0) - return path; - return NULL; + return _getcwd(path, max); +} + +// use _chdir() instead of SetCurrentDirectory() because it updates errno +int chdir(const char* path) +{ + return _chdir(path); } char *dirname(char *path) |

