summaryrefslogtreecommitdiffstats
path: root/cache.cxx
diff options
context:
space:
mode:
authorDave Brolley <brolley@redhat.com>2009-06-11 11:58:55 -0400
committerDave Brolley <brolley@redhat.com>2009-06-11 11:58:55 -0400
commitb12c8986778619db5bec0a5e52f2d49247e6b5ba (patch)
treeb5136adab377bb897ca7d132b1807487c19d61db /cache.cxx
parent36b66efaae572dddcfb04e9a995ca69063d0e1ff (diff)
downloadsystemtap-steved-b12c8986778619db5bec0a5e52f2d49247e6b5ba.tar.gz
systemtap-steved-b12c8986778619db5bec0a5e52f2d49247e6b5ba.tar.xz
systemtap-steved-b12c8986778619db5bec0a5e52f2d49247e6b5ba.zip
Only sign modules if --unprivileged is specified.
Don't generate an error message for unsigned modules. Make sure module signature exists before attempting to copy to the cache. Allow timer p[robes for unprivileged users.
Diffstat (limited to 'cache.cxx')
-rw-r--r--cache.cxx33
1 files changed, 12 insertions, 21 deletions
diff --git a/cache.cxx b/cache.cxx
index bfe2b527..200e51e9 100644
--- a/cache.cxx
+++ b/cache.cxx
@@ -79,16 +79,19 @@ add_to_cache(systemtap_session& s)
string module_signature_src_path = module_src_path;
module_signature_src_path += ".sgn";
- if (s.verbose > 1)
- clog << "Copying " << module_signature_src_path << " to " << module_signature_dest_path << endl;
- if (copy_file(module_signature_src_path.c_str(), module_signature_dest_path.c_str()) != 0)
+ if (file_exists (module_signature_src_path))
{
- cerr << "Copy failed (\"" << module_signature_src_path << "\" to \""
- << module_signature_dest_path << "\"): " << strerror(errno) << endl;
- // NB: this is not so severe as to prevent reuse of the .ko
- // already copied.
- //
- // s.use_cache = false;
+ if (s.verbose > 1)
+ clog << "Copying " << module_signature_src_path << " to " << module_signature_dest_path << endl;
+ if (copy_file(module_signature_src_path.c_str(), module_signature_dest_path.c_str()) != 0)
+ {
+ cerr << "Copy failed (\"" << module_signature_src_path << "\" to \""
+ << module_signature_dest_path << "\"): " << strerror(errno) << endl;
+ // NB: this is not so severe as to prevent reuse of the .ko
+ // already copied.
+ //
+ // s.use_cache = false;
+ }
}
#endif /* HAVE_NSS */
@@ -364,18 +367,6 @@ clean_cache(systemtap_session& s)
}
}
-// Get the size of a file in bytes
-static size_t
-get_file_size(const string &path)
-{
- struct stat file_info;
-
- if (stat(path.c_str(), &file_info) == 0)
- return file_info.st_size;
- else
- return 0;
-}
-
//Assign a weight for a particular file. A lower weight
// will be removed before a higher weight.
//TODO: for now use system mtime... later base a