diff options
| author | practicalswift <[email protected]> | 2017-01-12 22:51:26 +0100 |
|---|---|---|
| committer | practicalswift <[email protected]> | 2017-02-28 14:24:16 +0100 |
| commit | 58446094519151e2e203944267e592eec2470643 (patch) | |
| tree | f170cd69947777262c05683db90694723566c1c5 /src/netbase.cpp | |
| parent | Merge #9829: Fix importmulti returning rescan errors for wrong keys (diff) | |
| download | discoin-58446094519151e2e203944267e592eec2470643.tar.xz discoin-58446094519151e2e203944267e592eec2470643.zip | |
[net] Avoid initialization to a value that is never read
Prior to this commit the value stored to `s` at initialization
was never read (in the case of STRERROR_R_CHAR_P).
Diffstat (limited to 'src/netbase.cpp')
| -rw-r--r-- | src/netbase.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/netbase.cpp b/src/netbase.cpp index fc9a6ed0b..b26f7bcc1 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -672,13 +672,14 @@ std::string NetworkErrorString(int err) std::string NetworkErrorString(int err) { char buf[256]; - const char *s = buf; buf[0] = 0; /* Too bad there are two incompatible implementations of the * thread-safe strerror. */ + const char *s; #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 */ + s = buf; if (strerror_r(err, buf, sizeof(buf))) buf[0] = 0; #endif |