diff options
author | 2017-01-27 11:01:41 +0000 | |
---|---|---|
committer | 2017-01-27 13:43:08 +0000 | |
commit | 6f1e31a9aa4ad80e402b9a441d4129c7f1bd6fb7 (patch) | |
tree | 196001f4d4e155189fef6c5e4e2d677ae6f4e8e1 /src/main/cpp/util/errors.cc | |
parent | 7e7d6094b26e906ea0714e3b006f1458dfc3b825 (diff) |
Bazel client: platform-dependent `strerror`
Move `strerror` calls into errors_<platform>.
We have to get rid of direct `errno` reading too,
because it doesn't work on Windows native.
Fixes https://github.com/bazelbuild/bazel/issues/2411
--
Change-Id: I69ff502487d698aa9e9147f02fd0bc5253e94e64
Reviewed-on: https://cr.bazel.build/8490
PiperOrigin-RevId: 145777524
MOS_MIGRATED_REVID=145777524
Diffstat (limited to 'src/main/cpp/util/errors.cc')
-rw-r--r-- | src/main/cpp/util/errors.cc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/main/cpp/util/errors.cc b/src/main/cpp/util/errors.cc index 8497545e0b..112f293bf1 100644 --- a/src/main/cpp/util/errors.cc +++ b/src/main/cpp/util/errors.cc @@ -14,10 +14,9 @@ #include "src/main/cpp/util/errors.h" -#include <errno.h> #include <stdarg.h> -#include <stdlib.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> namespace blaze_util { @@ -37,7 +36,7 @@ void pdie(const int exit_status, const char *format, ...) { va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap); - fprintf(stderr, ": %s\n", strerror(errno)); + fprintf(stderr, ": %s\n", GetLastErrorString().c_str()); exit(exit_status); } @@ -47,7 +46,7 @@ void PrintError(const char *format, ...) { va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap); - fprintf(stderr, ": %s\n", strerror(errno)); + fprintf(stderr, ": %s\n", GetLastErrorString().c_str()); } } // namespace blaze_util |