Switch to unified view

a/src/index/indexer.cpp b/src/index/indexer.cpp
1
#ifndef lint
1
#ifndef lint
2
static char rcsid[] = "@(#$Id: indexer.cpp,v 1.45 2006-11-30 13:38:44 dockes Exp $ (C) 2004 J.F.Dockes";
2
static char rcsid[] = "@(#$Id: indexer.cpp,v 1.46 2006-12-14 13:53:43 dockes Exp $ (C) 2004 J.F.Dockes";
3
#endif
3
#endif
4
/*
4
/*
5
 *   This program is free software; you can redistribute it and/or modify
5
 *   This program is free software; you can redistribute it and/or modify
6
 *   it under the terms of the GNU General Public License as published by
6
 *   it under the terms of the GNU General Public License as published by
7
 *   the Free Software Foundation; either version 2 of the License, or
7
 *   the Free Software Foundation; either version 2 of the License, or
...
...
161
    return true;
161
    return true;
162
}
162
}
163
163
164
bool DbIndexer::init(bool resetbefore, bool rdonly)
164
bool DbIndexer::init(bool resetbefore, bool rdonly)
165
{
165
{
166
    if (m_tmpdir.empty() || access(m_tmpdir.c_str(), 0) < 0)
166
    if (m_tmpdir.empty() || access(m_tmpdir.c_str(), 0) < 0) {
167
  string reason;
167
    if (!maketmpdir(m_tmpdir)) {
168
    if (!maketmpdir(m_tmpdir, reason)) {
168
        LOGERR(("DbIndexer: cannot create temporary directory\n"));
169
        LOGERR(("DbIndexer: cannot create temporary directory: %s\n",
170
          reason.c_str()));
169
        return false;
171
        return false;
170
    }
172
    }
173
    }
171
    Rcl::Db::OpenMode mode = rdonly ? Rcl::Db::DbRO :
174
    Rcl::Db::OpenMode mode = rdonly ? Rcl::Db::DbRO :
172
    resetbefore ? Rcl::Db::DbTrunc : Rcl::Db::DbUpd;
175
    resetbefore ? Rcl::Db::DbTrunc : Rcl::Db::DbUpd;
173
    if (!m_db.open(m_dbdir, mode)) {
176
    if (!m_db.open(m_dbdir, mode)) {
174
    LOGERR(("DbIndexer: error opening database in %s\n", m_dbdir.c_str()));
177
    LOGERR(("DbIndexer: error opening database in %s\n", m_dbdir.c_str()));
175
    return false;
178
    return false;