summaryrefslogtreecommitdiffstats
path: root/util.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 /util.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 'util.cxx')
-rw-r--r--util.cxx24
1 files changed, 24 insertions, 0 deletions
diff --git a/util.cxx b/util.cxx
index 5c05a1dd..a258bf72 100644
--- a/util.cxx
+++ b/util.cxx
@@ -51,6 +51,30 @@ get_home_directory(void)
}
+// Get the size of a file in bytes
+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;
+}
+
+// Get the size of a file in bytes
+bool
+file_exists (const string &path)
+{
+ struct stat file_info;
+
+ if (stat(path.c_str(), &file_info) == 0)
+ return true;
+
+ return false;
+}
+
// Copy a file. The copy is done via a temporary file and atomic
// rename.
int