summaryrefslogtreecommitdiffstats
path: root/util.cxx
diff options
context:
space:
mode:
authorDave Brolley <brolley@redhat.com>2009-05-04 16:05:22 -0400
committerDave Brolley <brolley@redhat.com>2009-05-04 16:05:22 -0400
commit2035bcd40b17832439df0a1eb28403b99a71b74f (patch)
tree0fb027ba40f34513279f2e39e1110b50a415d2c1 /util.cxx
parent3ba2eb82cafa938c1c3f7ef9d2da06912a49d8e0 (diff)
downloadsystemtap-steved-2035bcd40b17832439df0a1eb28403b99a71b74f.tar.gz
systemtap-steved-2035bcd40b17832439df0a1eb28403b99a71b74f.tar.xz
systemtap-steved-2035bcd40b17832439df0a1eb28403b99a71b74f.zip
Module signing and verification using a separate file for the module signature.
Diffstat (limited to 'util.cxx')
-rw-r--r--util.cxx21
1 files changed, 20 insertions, 1 deletions
diff --git a/util.cxx b/util.cxx
index 5fa7a5f2..5c05a1dd 100644
--- a/util.cxx
+++ b/util.cxx
@@ -1,5 +1,5 @@
// Copyright (C) Andrew Tridgell 2002 (original file)
-// Copyright (C) 2006 Red Hat Inc. (systemtap changes)
+// Copyright (C) 2006, 2009 Red Hat Inc. (systemtap changes)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
@@ -135,6 +135,25 @@ create_dir(const char *dir)
return 0;
}
+// Remove a file or directory
+int
+remove_file_or_dir (const char *name)
+{
+ int rc;
+ struct stat st;
+
+ if ((rc = stat(name, &st)) != 0)
+ {
+ if (errno == ENOENT)
+ return 0;
+ return 1;
+ }
+
+ if (remove (name) != 0)
+ return 1;
+ cerr << "remove returned 0" << endl;
+ return 0;
+}
void
tokenize(const string& str, vector<string>& tokens,