From 9454102a49a265d8041cdb04d69fb65d511575c8 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sun, 29 Jan 2012 17:26:14 -0800 Subject: [PATCH] admin_socket: fix uninit warning warning: common/admin_socket_client.cc:166:19: 'socket_fd' may be used uninitialized in this function [-Wuninitialized] Signed-off-by: Sage Weil --- src/common/admin_socket_client.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/common/admin_socket_client.cc b/src/common/admin_socket_client.cc index f9798737bb6..782e808ad86 100644 --- a/src/common/admin_socket_client.cc +++ b/src/common/admin_socket_client.cc @@ -128,14 +128,14 @@ AdminSocketClient(const std::string &path) std::string AdminSocketClient::do_request(std::string request, std::string *result) { - int socket_fd, res; + int socket_fd = 0, res; std::vector vec(65536, 0); uint8_t *buffer = &vec[0]; uint32_t message_size_raw, message_size; std::string err = asok_connect(m_path, &socket_fd); if (!err.empty()) { - goto done; + goto out; } err = asok_request(socket_fd, request); if (!err.empty()) { @@ -164,5 +164,6 @@ std::string AdminSocketClient::do_request(std::string request, std::string *resu result->assign((const char*)buffer); done: close(socket_fd); + out: return err; }