From d084ac98994647e5cf6ebe73b3d1578bb4609fbc Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Mon, 26 Nov 2012 09:14:51 +0100 Subject: [PATCH] Observe followSymlinks in indexfiles() --- src/index/fsindexer.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/index/fsindexer.cpp b/src/index/fsindexer.cpp index 156d3e27..920898ce 100644 --- a/src/index/fsindexer.cpp +++ b/src/index/fsindexer.cpp @@ -274,8 +274,10 @@ bool FsIndexer::indexFiles(list& files, ConfIndexer::IxFlag flag) m_config->setKeyDir(path_getfather(*it)); if (m_havelocalfields) localfieldsfromconf(); - walker.setSkippedNames(m_config->getSkippedNames()); + bool follow = false; + m_config->getConfParam("followLinks", &follow); + walker.setSkippedNames(m_config->getSkippedNames()); // Check path against indexed areas and skipped names/paths if (!(flag&ConfIndexer::IxFIgnoreSkip) && matchesSkipped(m_tdl, walker, *it)) { @@ -283,7 +285,9 @@ bool FsIndexer::indexFiles(list& files, ConfIndexer::IxFlag flag) } struct stat stb; - if (lstat(it->c_str(), &stb) != 0) { + int ststat = follow ? stat(it->c_str(), &stb) : + lstat(it->c_str(), &stb); + if (ststat != 0) { LOGERR(("FsIndexer::indexFiles: lstat(%s): %s", it->c_str(), strerror(errno))); it++; continue; @@ -369,11 +373,12 @@ void *FsIndexerDbUpdWorker(void * fsp) DbUpdTask *tsk; for (;;) { - if (!tqp->take(&tsk)) { + size_t qsz; + if (!tqp->take(&tsk, &qsz)) { tqp->workerExit(); return (void*)1; } - LOGDEB(("FsIndexerDbUpdWorker: got task, ql %d\n", int(tqp->size()))); + LOGDEB(("FsIndexerDbUpdWorker: got task, ql %d\n", int(qsz))); if (!fip->m_db->addOrUpdate(tsk->config, tsk->udi, tsk->parent_udi, tsk->doc)) { LOGERR(("FsIndexerDbUpdWorker: addOrUpdate failed\n"));