summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2009-07-20 17:57:56 -0700
committerJosh Stone <jistone@redhat.com>2009-07-20 18:08:15 -0700
commit9a193b06eb0e5ca463576e4fa9e8da0a70022a4a (patch)
tree9e00a84a8dd9f0435a7999fc99328a6980ff51fc
parent0c16d51256bc77c2b5497b72ec43b7864d2b47a8 (diff)
downloadsystemtap-steved-9a193b06eb0e5ca463576e4fa9e8da0a70022a4a.tar.gz
systemtap-steved-9a193b06eb0e5ca463576e4fa9e8da0a70022a4a.tar.xz
systemtap-steved-9a193b06eb0e5ca463576e4fa9e8da0a70022a4a.zip
Make sure that non-existent files still affect hashing
The fact that a file _doesn't_ exist is significant, so adding such a file to a computed hash should still influence the output. * hash.cxx (hash::add_file): add bogus stat info for non-existent files
-rw-r--r--hash.cxx12
1 files changed, 6 insertions, 6 deletions
diff --git a/hash.cxx b/hash.cxx
index e550be76..a0608c03 100644
--- a/hash.cxx
+++ b/hash.cxx
@@ -52,12 +52,12 @@ hash::add_file(const std::string& filename)
{
struct stat st;
- if (stat(filename.c_str(), &st) == 0)
- {
- add(filename);
- add(st.st_size);
- add(st.st_mtime);
- }
+ if (stat(filename.c_str(), &st) != 0)
+ st.st_size = st.st_mtime = -1;
+
+ add(filename);
+ add(st.st_size);
+ add(st.st_mtime);
}