Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cd7c1ed7 authored by Josh Gao's avatar Josh Gao
Browse files

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
parent d9731573
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -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<copyinfo>* filelist,
                            const std::string& lpath, const std::string& rpath) {
static bool local_build_list(SyncConnection& sc, std::vector<copyinfo>* filelist,
                             const std::string& lpath,
                             const std::string& rpath) {
    std::vector<copyinfo> dirlist;
    std::unique_ptr<DIR, int (*)(DIR*)> 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<copyinfo>* 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<copyinfo> 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;
    }