diff options
author | Josh Stone <jistone@redhat.com> | 2009-07-20 17:57:56 -0700 |
---|---|---|
committer | Josh Stone <jistone@redhat.com> | 2009-07-20 18:08:15 -0700 |
commit | 9a193b06eb0e5ca463576e4fa9e8da0a70022a4a (patch) | |
tree | 9e00a84a8dd9f0435a7999fc99328a6980ff51fc | |
parent | 0c16d51256bc77c2b5497b72ec43b7864d2b47a8 (diff) | |
download | systemtap-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.cxx | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -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); } |