summaryrefslogtreecommitdiff
path: root/src/googletest.h
diff options
context:
space:
mode:
author <shinichiro.hamaji@gmail.com>2013-10-31 05:39:43 +0000
committer <shinichiro.hamaji@gmail.com>2013-10-31 05:39:43 +0000
commita0073e504be20faa7e9c3b31ba795bdcfb99c967 (patch)
treeec00bff98efd5b40bb130812a5432221e6be470a /src/googletest.h
parent0242c8e94d5857c313b2df0354f34003ed99f329 (diff)
downloadglog-a0073e504be20faa7e9c3b31ba795bdcfb99c967.tar.gz
glog-a0073e504be20faa7e9c3b31ba795bdcfb99c967.tar.bz2
glog-a0073e504be20faa7e9c3b31ba795bdcfb99c967.zip
Add StrError and replace posix_strerror_r calls
For now, we do not remove the declaration of posix_strerror_r, but we might remove it in future. git-svn-id: https://google-glog.googlecode.com/svn/trunk@139 eb4d4688-79bd-11dd-afb4-1d65580434c0
Diffstat (limited to 'src/googletest.h')
-rw-r--r--src/googletest.h18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/googletest.h b/src/googletest.h
index 21e4f64..2525bc3 100644
--- a/src/googletest.h
+++ b/src/googletest.h
@@ -450,19 +450,11 @@ static inline string Munge(const string& filename) {
// Remove 0x prefix produced by %p. VC++ doesn't put the prefix.
StringReplace(&line, " 0x", " ");
- char errmsg_buf[100];
- posix_strerror_r(0, errmsg_buf, sizeof(errmsg_buf));
- if (*errmsg_buf == '\0') {
- // MacOSX 10.4 and FreeBSD return empty string for errno=0.
- // In such case, the we need to remove an extra space.
- StringReplace(&line, "__SUCCESS__ ", "");
- } else {
- StringReplace(&line, "__SUCCESS__", errmsg_buf);
- }
- StringReplace(&line, "__ENOENT__", strerror(ENOENT));
- StringReplace(&line, "__EINTR__", strerror(EINTR));
- StringReplace(&line, "__ENXIO__", strerror(ENXIO));
- StringReplace(&line, "__ENOEXEC__", strerror(ENOEXEC));
+ StringReplace(&line, "__SUCCESS__", StrError(0));
+ StringReplace(&line, "__ENOENT__", StrError(ENOENT));
+ StringReplace(&line, "__EINTR__", StrError(EINTR));
+ StringReplace(&line, "__ENXIO__", StrError(ENXIO));
+ StringReplace(&line, "__ENOEXEC__", StrError(ENOEXEC));
result += line + "\n";
}
fclose(fp);