From b12c8986778619db5bec0a5e52f2d49247e6b5ba Mon Sep 17 00:00:00 2001 From: Dave Brolley Date: Thu, 11 Jun 2009 11:58:55 -0400 Subject: 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. --- util.cxx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'util.cxx') 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 -- cgit