Loading adb/file_sync_client.cpp +6 −21 Original line number Original line Diff line number Diff line Loading @@ -517,12 +517,6 @@ static bool sync_recv(SyncConnection& sc, const char* rpath, const char* lpath) if (!sc.SendRequest(ID_RECV, rpath)) return false; if (!sc.SendRequest(ID_RECV, rpath)) return false; adb_unlink(lpath); adb_unlink(lpath); const std::string dirpath = adb_dirname(lpath); if (!mkdirs(dirpath.c_str())) { sc.Error("failed to create parent directory '%s': %s", dirpath.c_str(), strerror(errno)); return false; } int lfd = adb_creat(lpath, 0644); int lfd = adb_creat(lpath, 0644); if (lfd < 0) { if (lfd < 0) { sc.Error("cannot create '%s': %s", lpath, strerror(errno)); sc.Error("cannot create '%s': %s", lpath, strerror(errno)); Loading Loading @@ -803,13 +797,14 @@ static bool remote_symlink_isdir(SyncConnection& sc, const std::string& rpath) { return S_ISDIR(mode); return S_ISDIR(mode); } } static bool remote_build_list(SyncConnection& sc, static bool remote_build_list(SyncConnection& sc, std::vector<copyinfo>* file_list, std::vector<copyinfo>* file_list, const std::string& rpath, const std::string& lpath) { const std::string& rpath, const std::string& lpath) { std::vector<copyinfo> dirlist; std::vector<copyinfo> dirlist; std::vector<copyinfo> linklist; std::vector<copyinfo> linklist; bool empty_dir = true; // Add an entry for the current directory to ensure it gets created before pulling its contents. copyinfo ci(adb_dirname(lpath), adb_dirname(rpath), adb_basename(rpath), S_IFDIR); file_list->push_back(ci); // Put the files/dirs in rpath on the lists. // Put the files/dirs in rpath on the lists. auto callback = [&](unsigned mode, unsigned size, unsigned time, const char* name) { auto callback = [&](unsigned mode, unsigned size, unsigned time, const char* name) { Loading @@ -817,9 +812,6 @@ static bool remote_build_list(SyncConnection& sc, return; return; } } // We found a child that isn't '.' or '..'. empty_dir = false; copyinfo ci(lpath, rpath, name, mode); copyinfo ci(lpath, rpath, name, mode); if (S_ISDIR(mode)) { if (S_ISDIR(mode)) { dirlist.push_back(ci); dirlist.push_back(ci); Loading @@ -836,13 +828,6 @@ static bool remote_build_list(SyncConnection& sc, return false; return false; } } // Add the current directory to the list if it was empty, to ensure that it gets created. if (empty_dir) { copyinfo ci(adb_dirname(lpath), adb_dirname(rpath), adb_basename(rpath), S_IFDIR); file_list->push_back(ci); return true; } // Check each symlink we found to see whether it's a file or directory. // Check each symlink we found to see whether it's a file or directory. for (copyinfo& link_ci : linklist) { for (copyinfo& link_ci : linklist) { if (remote_symlink_isdir(sc, link_ci.rpath)) { if (remote_symlink_isdir(sc, link_ci.rpath)) { Loading Loading
adb/file_sync_client.cpp +6 −21 Original line number Original line Diff line number Diff line Loading @@ -517,12 +517,6 @@ static bool sync_recv(SyncConnection& sc, const char* rpath, const char* lpath) if (!sc.SendRequest(ID_RECV, rpath)) return false; if (!sc.SendRequest(ID_RECV, rpath)) return false; adb_unlink(lpath); adb_unlink(lpath); const std::string dirpath = adb_dirname(lpath); if (!mkdirs(dirpath.c_str())) { sc.Error("failed to create parent directory '%s': %s", dirpath.c_str(), strerror(errno)); return false; } int lfd = adb_creat(lpath, 0644); int lfd = adb_creat(lpath, 0644); if (lfd < 0) { if (lfd < 0) { sc.Error("cannot create '%s': %s", lpath, strerror(errno)); sc.Error("cannot create '%s': %s", lpath, strerror(errno)); Loading Loading @@ -803,13 +797,14 @@ static bool remote_symlink_isdir(SyncConnection& sc, const std::string& rpath) { return S_ISDIR(mode); return S_ISDIR(mode); } } static bool remote_build_list(SyncConnection& sc, static bool remote_build_list(SyncConnection& sc, std::vector<copyinfo>* file_list, std::vector<copyinfo>* file_list, const std::string& rpath, const std::string& lpath) { const std::string& rpath, const std::string& lpath) { std::vector<copyinfo> dirlist; std::vector<copyinfo> dirlist; std::vector<copyinfo> linklist; std::vector<copyinfo> linklist; bool empty_dir = true; // Add an entry for the current directory to ensure it gets created before pulling its contents. copyinfo ci(adb_dirname(lpath), adb_dirname(rpath), adb_basename(rpath), S_IFDIR); file_list->push_back(ci); // Put the files/dirs in rpath on the lists. // Put the files/dirs in rpath on the lists. auto callback = [&](unsigned mode, unsigned size, unsigned time, const char* name) { auto callback = [&](unsigned mode, unsigned size, unsigned time, const char* name) { Loading @@ -817,9 +812,6 @@ static bool remote_build_list(SyncConnection& sc, return; return; } } // We found a child that isn't '.' or '..'. empty_dir = false; copyinfo ci(lpath, rpath, name, mode); copyinfo ci(lpath, rpath, name, mode); if (S_ISDIR(mode)) { if (S_ISDIR(mode)) { dirlist.push_back(ci); dirlist.push_back(ci); Loading @@ -836,13 +828,6 @@ static bool remote_build_list(SyncConnection& sc, return false; return false; } } // Add the current directory to the list if it was empty, to ensure that it gets created. if (empty_dir) { copyinfo ci(adb_dirname(lpath), adb_dirname(rpath), adb_basename(rpath), S_IFDIR); file_list->push_back(ci); return true; } // Check each symlink we found to see whether it's a file or directory. // Check each symlink we found to see whether it's a file or directory. for (copyinfo& link_ci : linklist) { for (copyinfo& link_ci : linklist) { if (remote_symlink_isdir(sc, link_ci.rpath)) { if (remote_symlink_isdir(sc, link_ci.rpath)) { Loading