From cd7c1ed700707e3f3aea341c38d38e18ae410987 Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Tue, 3 Nov 2015 15:26:38 -0800 Subject: [PATCH] adb: make local_build_list match remote_build_list. local_build_list previously was returning an int, 0 on success and -1 on failure, while remote_build_list was returning a bool, true on success and false on failure. Change-Id: Iced6c4142e2f843048d81c4e133d6b6dc75a35dd --- adb/file_sync_client.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/adb/file_sync_client.cpp b/adb/file_sync_client.cpp index 2262a93e9..44f3cfd78 100644 --- a/adb/file_sync_client.cpp +++ b/adb/file_sync_client.cpp @@ -495,13 +495,14 @@ static bool IsDotOrDotDot(const char* name) { return name[0] == '.' && (name[1] == '\0' || (name[1] == '.' && name[2] == '\0')); } -static int local_build_list(SyncConnection& sc, std::vector* filelist, - const std::string& lpath, const std::string& rpath) { +static bool local_build_list(SyncConnection& sc, std::vector* filelist, + const std::string& lpath, + const std::string& rpath) { std::vector dirlist; std::unique_ptr dir(opendir(lpath.c_str()), closedir); if (!dir) { sc.Error("cannot open '%s': %s", lpath.c_str(), strerror(errno)); - return -1; + return false; } dirent* de; @@ -537,7 +538,7 @@ static int local_build_list(SyncConnection& sc, std::vector* filelist, local_build_list(sc, filelist, ci.src.c_str(), ci.dst.c_str()); } - return 0; + return true; } static bool copy_local_dir_remote(SyncConnection& sc, std::string lpath, @@ -558,7 +559,7 @@ static bool copy_local_dir_remote(SyncConnection& sc, std::string lpath, std::vector filelist; int pushed = 0; int skipped = 0; - if (local_build_list(sc, &filelist, lpath, rpath)) { + if (!local_build_list(sc, &filelist, lpath, rpath)) { return false; }