aboutsummaryrefslogtreecommitdiff
path: root/gdb/nat
diff options
context:
space:
mode:
authorChristian Biesinger <cbiesinger@google.com>2019-08-27 13:22:38 -0500
committerChristian Biesinger <cbiesinger@google.com>2019-08-27 13:53:05 -0500
commit550105b77914a8b06498318775b28e85c610b9a3 (patch)
tree59ab569720c1cbe57c0df826c2c98b195efb17a4 /gdb/nat
parentec1b0fbb8dffc09f64f65b6459b786c35218803a (diff)
downloadbinutils-550105b77914a8b06498318775b28e85c610b9a3.zip
binutils-550105b77914a8b06498318775b28e85c610b9a3.tar.gz
binutils-550105b77914a8b06498318775b28e85c610b9a3.tar.bz2
Fix compiler warning in linux-namespaces.c
../../gdb/nat/linux-namespaces.c: In function ‘void mnsh_main(int)’: ../../gdb/nat/linux-namespaces.c:604:8: warning: ‘fd’ may be used uninitialized in this function [-Wmaybe-uninitialized] close (fd); ~~~~~~^~~~ And the warning is correct -- mnsh_recv_message can return -1 and leave fd uninitialized, and mnsh_main will still call close (fd) if that happens. Initialize fd to -1 to avoid that. gdb/ChangeLog: 2019-08-27 Christian Biesinger <cbiesinger@google.com> * nat/linux-namespaces.c (mnsh_main): Initialize fd (to -1).
Diffstat (limited to 'gdb/nat')
-rw-r--r--gdb/nat/linux-namespaces.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/nat/linux-namespaces.c b/gdb/nat/linux-namespaces.c
index 503f755..e49bc1a 100644
--- a/gdb/nat/linux-namespaces.c
+++ b/gdb/nat/linux-namespaces.c
@@ -562,7 +562,7 @@ mnsh_main (int sock)
while (1)
{
enum mnsh_msg_type type;
- int fd, int1, int2;
+ int fd = -1, int1, int2;
char buf[PATH_MAX];
ssize_t size, response = -1;