From: Arvin Schnell Date: Thu, 24 Feb 2011 14:04:41 +0000 (+0100) Subject: - fixed "stay on filesystem" X-Git-Tag: v0.1.3~457 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2b6f2018df644b83523003885d05a863f732acdd;p=thirdparty%2Fsnapper.git - fixed "stay on filesystem" --- diff --git a/snapper/Compare.cc b/snapper/Compare.cc index c8e4ce57..292592a2 100644 --- a/snapper/Compare.cc +++ b/snapper/Compare.cc @@ -339,24 +339,48 @@ namespace snapper while (first1 != last1 || first2 != last2) { + // TODO: move stat to readDirectory + + struct stat stat1; + if (first1 != last1) + { + int r1 = lstat((cmp_data.base_path1 + path + "/" + *first1).c_str(), &stat1); + assert(r1 == 0); + } + + struct stat stat2; + if (first2 != last2) + { + int r2 = lstat((cmp_data.base_path2 + path + "/" + *first2).c_str(), &stat2); + assert(r2 == 0); + } + if (first1 == last1) { - lonesome(cmp_data.base_path2, path, *first2, CREATED, cmp_data.cb); + if (stat2.st_dev == cmp_data.dev2) + lonesome(cmp_data.base_path2, path, *first2, CREATED, cmp_data.cb); + ++first2; } else if (first2 == last2) { - lonesome(cmp_data.base_path1, path, *first1, DELETED, cmp_data.cb); + if (stat1.st_dev == cmp_data.dev1) + lonesome(cmp_data.base_path1, path, *first1, DELETED, cmp_data.cb); + ++first1; } else if (*first2 < *first1) { - lonesome(cmp_data.base_path2, path, *first2, CREATED, cmp_data.cb); + if (stat2.st_dev == cmp_data.dev2) + lonesome(cmp_data.base_path2, path, *first2, CREATED, cmp_data.cb); + ++first2; } else if (*first1 < *first2) { - lonesome(cmp_data.base_path1, path, *first1, DELETED, cmp_data.cb); + if (stat1.st_dev == cmp_data.dev1) + lonesome(cmp_data.base_path1, path, *first1, DELETED, cmp_data.cb); + ++first1; } else