Skip to content

Commit 7e96ecf

Browse files
committed
Merge #9539: [net] Avoid initialization to a value that is never read
5844609 [net] Avoid initialization to a value that is never read (practicalswift) Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
2 parents ce8176d + 5844609 commit 7e96ecf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/netbase.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,13 +668,14 @@ std::string NetworkErrorString(int err)
668668
std::string NetworkErrorString(int err)
669669
{
670670
char buf[256];
671-
const char *s = buf;
672671
buf[0] = 0;
673672
/* Too bad there are two incompatible implementations of the
674673
* thread-safe strerror. */
674+
const char *s;
675675
#ifdef STRERROR_R_CHAR_P /* GNU variant can return a pointer outside the passed buffer */
676676
s = strerror_r(err, buf, sizeof(buf));
677677
#else /* POSIX variant always returns message in buffer */
678+
s = buf;
678679
if (strerror_r(err, buf, sizeof(buf)))
679680
buf[0] = 0;
680681
#endif

0 commit comments

Comments
 (0)