Browse Source

Merge pull request #92 from trapexit/timecompare

use gte rather than gt for mtime comparisons. fixes #91
pull/93/head
Antonio SJ Musumeci 9 years ago
parent
commit
416cb4a084
  1. 9
      src/policy_newest.cpp

9
src/policy_newest.cpp

@ -29,6 +29,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <limits>
#include "policy.hpp" #include "policy.hpp"
@ -42,11 +43,9 @@ _newest(const vector<string> &basepaths,
const string &fusepath, const string &fusepath,
vector<string> &paths) vector<string> &paths)
{ {
time_t newest;
const char *neweststr;
time_t newest = std::numeric_limits<time_t>::min();
const char *neweststr = NULL;
newest = 0;
neweststr = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++) for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{ {
int rv; int rv;
@ -58,7 +57,7 @@ _newest(const vector<string> &basepaths,
fullpath = fs::path::make(basepath,fusepath); fullpath = fs::path::make(basepath,fusepath);
rv = ::lstat(fullpath.c_str(),&st); rv = ::lstat(fullpath.c_str(),&st);
if(rv == 0 && st.st_mtime > newest)
if(rv == 0 && st.st_mtime >= newest)
{ {
newest = st.st_mtime; newest = st.st_mtime;
neweststr = basepath; neweststr = basepath;

Loading…
Cancel
Save