aboutsummaryrefslogtreecommitdiff
path: root/src/netbase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/netbase.cpp')
-rw-r--r--src/netbase.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/netbase.cpp b/src/netbase.cpp
index 175406322a..067cfa024b 100644
--- a/src/netbase.cpp
+++ b/src/netbase.cpp
@@ -1252,7 +1252,8 @@ std::string NetworkErrorString(int err)
#ifdef STRERROR_R_CHAR_P /* GNU variant can return a pointer outside the passed buffer */
s = strerror_r(err, buf, sizeof(buf));
#else /* POSIX variant always returns message in buffer */
- (void) strerror_r(err, buf, sizeof(buf));
+ if (strerror_r(err, buf, sizeof(buf)))
+ buf[0] = 0;
#endif
return strprintf("%s (%d)", s, err);
}