From 6ad06b9ea944555a55b4a9da858f241ef07121eb Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Thu, 28 Jan 2016 16:21:12 -0800 Subject: [PATCH] adb: fix mistaken uses of SendFail in file_sync_service.cpp. SendFail and SendSyncFail are similarly named, and have the same prototype. Use `#pragma GCC poison` to prevent use of SendFail in file_sync_service.cpp, and fix the places where it was used accidentally. Change-Id: I6b9a7e565b76dfab10f8ae38f889d046ad80a403 --- adb/file_sync_service.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/adb/file_sync_service.cpp b/adb/file_sync_service.cpp index ef0418e5e..29c662929 100644 --- a/adb/file_sync_service.cpp +++ b/adb/file_sync_service.cpp @@ -130,6 +130,9 @@ done: return WriteFdExactly(s, &msg.dent, sizeof(msg.dent)); } +// Make sure that SendFail from adb_io.cpp isn't accidentally used in this file. +#pragma GCC poison SendFail + static bool SendSyncFail(int fd, const std::string& reason) { D("sync: failure: %s", reason.c_str()); @@ -265,7 +268,7 @@ static bool handle_send_link(int s, const std::string& path, std::vector& msg.status.msglen = 0; if (!WriteFdExactly(s, &msg.status, sizeof(msg.status))) return false; } else { - SendFail(s, "invalid data message: expected ID_DONE"); + SendSyncFail(s, "invalid data message: expected ID_DONE"); return false; } @@ -277,7 +280,7 @@ static bool do_send(int s, const std::string& spec, std::vector& buffer) { // 'spec' is of the form "/some/path,0755". Break it up. size_t comma = spec.find_last_of(','); if (comma == std::string::npos) { - SendFail(s, "missing , in ID_SEND"); + SendSyncFail(s, "missing , in ID_SEND"); return false; } @@ -286,7 +289,7 @@ static bool do_send(int s, const std::string& spec, std::vector& buffer) { errno = 0; mode_t mode = strtoul(spec.substr(comma + 1).c_str(), nullptr, 0); if (errno != 0) { - SendFail(s, "bad mode"); + SendSyncFail(s, "bad mode"); return false; }