Skip to content

Commit

Permalink
fix checking timestamp with different target root
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jreidinger committed Oct 3, 2013
1 parent 92b0959 commit 3b48406
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions agent-ini/src/IniParser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ bool FileDescr::changed ()
return false;
}

FileDescr::FileDescr (char*fn_)
FileDescr::FileDescr (const char*fn_)
{
fn = fn_;
sn = fn_;
Expand Down Expand Up @@ -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()));
Expand All @@ -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()));
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion agent-ini/src/IniParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ struct FileDescr
* Time of the last modification
*/
time_t timestamp;
FileDescr (char*fn);
FileDescr (const char*fn);
bool changed ();
FileDescr () {}
};
Expand Down

0 comments on commit 3b48406

Please sign in to comment.