From fdb9800fcc28a107889cc14f33129cff746fff6d Mon Sep 17 00:00:00 2001 From: Greg Kaiser Date: Mon, 28 Jan 2019 06:17:44 -0800 Subject: [PATCH] adb: Fix incorrect logging statement We were logging "fd.get()" after we had already done a "std::move(fd)". That won't log the value we were hoping for. We instead cache the file descriptor value in a local int prior to the move(), and log that. Test: TreeHugger Change-Id: I715874ac63329280ffb55881fb2590fb31dc2457 --- adb/sockets.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/adb/sockets.cpp b/adb/sockets.cpp index 5b4c51e3a..f7c39f0a1 100644 --- a/adb/sockets.cpp +++ b/adb/sockets.cpp @@ -359,8 +359,9 @@ asocket* create_local_service_socket(std::string_view name, atransport* transpor return nullptr; } + int fd_value = fd.get(); asocket* s = create_local_socket(std::move(fd)); - LOG(VERBOSE) << "LS(" << s->id << "): bound to '" << name << "' via " << fd.get(); + LOG(VERBOSE) << "LS(" << s->id << "): bound to '" << name << "' via " << fd_value; #if !ADB_HOST if ((name.starts_with("root:") && getuid() != 0 && __android_log_is_debuggable()) ||