From 3b48406842a0de199035dc55cc8c40fc44f97921 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Thu, 3 Oct 2013 10:32:17 +0200 Subject: [PATCH] fix checking timestamp with different target root ignoring root meant rereading the files on every SCR call or broekn detection if file change. Also cause warning in log if file doesn't exist during installation --- agent-ini/src/IniParser.cc | 10 +++++----- agent-ini/src/IniParser.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/agent-ini/src/IniParser.cc b/agent-ini/src/IniParser.cc index 3c2442f23..97b3e4832 100644 --- a/agent-ini/src/IniParser.cc +++ b/agent-ini/src/IniParser.cc @@ -472,7 +472,7 @@ bool FileDescr::changed () return false; } -FileDescr::FileDescr (char*fn_) +FileDescr::FileDescr (const char*fn_) { fn = fn_; sn = fn_; @@ -525,7 +525,7 @@ int IniParser::parse() y2error ("Cannot open %s.", *f); else { - FileDescr fdsc (*f); + FileDescr fdsc (agent.targetPath(*f).c_str()); multi_files[*f] = fdsc; inifile.initSection (section_name, "", -1, section_index); parse_helper(inifile.getSection(section_name.c_str())); @@ -541,7 +541,7 @@ int IniParser::parse() else { y2debug ("File %s changed. Reloading.", *f); - FileDescr fdsc (*f); + FileDescr fdsc (agent.targetPath(*f).c_str()); multi_files [*f] = fdsc; inifile.initSection (section_name, "", -1, section_index); parse_helper(inifile.getSection(section_name.c_str())); @@ -927,9 +927,9 @@ time_t IniParser::getTimeStamp() printf ("bad call of getTimeStamp aborting. FIXME\n");//FIXME abort (); } - if (stat(file.c_str(), &st)) + if (stat(agent.targetPath(file).c_str(), &st)) { - y2error("Unable to stat '%s': %s", file.c_str(), strerror(errno)); + y2error("Unable to stat '%s': %s", agent.targetPath(file).c_str(), strerror(errno)); return 0; } return st.st_mtime; diff --git a/agent-ini/src/IniParser.h b/agent-ini/src/IniParser.h index 5fc448685..e578491fd 100644 --- a/agent-ini/src/IniParser.h +++ b/agent-ini/src/IniParser.h @@ -245,7 +245,7 @@ struct FileDescr * Time of the last modification */ time_t timestamp; - FileDescr (char*fn); + FileDescr (const char*fn); bool changed (); FileDescr () {} };