Centralize stat calls to ensure consistency of time fields on windows

This commit is contained in:
Jean-Francois Dockes
2016-01-08 11:23:10 +01:00
parent b2066f6133
commit ff15f8fb1c
9 changed files with 52 additions and 18 deletions
+1 -1
View File
@@ -342,7 +342,7 @@ bool BeagleQueueIndexer::indexFiles(list<string>& files)
it++; continue;
}
struct stat st;
if (lstat(it->c_str(), &st) != 0) {
if (path_fileprops(*it, &st) != 0) {
LOGERR(("BeagleQueueIndexer::indexfiles: cant stat [%s]\n",
it->c_str()));
it++; continue;
+2 -2
View File
@@ -21,11 +21,11 @@
#include "debuglog.h"
#include "cstr.h"
#include "fetcher.h"
#include "fsfetcher.h"
#include "fsindexer.h"
#include "debuglog.h"
#include "pathut.h"
using std::string;
@@ -43,7 +43,7 @@ static bool urltopath(RclConfig* cnf,
bool follow = false;
cnf->getConfParam("followLinks", &follow);
if ((follow ? stat(fn.c_str(), &st) : lstat(fn.c_str(), &st))< 0) {
if (path_fileprops(fn, &st, follow) < 0) {
LOGERR(("FSDocFetcher::fetch: stat errno %d for [%s]\n",
errno, fn.c_str()));
return false;
+2 -3
View File
@@ -362,10 +362,9 @@ bool FsIndexer::indexFiles(list<string>& files, int flags)
}
struct stat stb;
int ststat = follow ? stat(it->c_str(), &stb) :
lstat(it->c_str(), &stb);
int ststat = path_fileprops(*it, &stb, follow);
if (ststat != 0) {
LOGERR(("FsIndexer::indexFiles: lstat(%s): %s", it->c_str(),
LOGERR(("FsIndexer::indexFiles: (l)stat %s: %s", it->c_str(),
strerror(errno)));
it++;
continue;