From 2035bcd40b17832439df0a1eb28403b99a71b74f Mon Sep 17 00:00:00 2001 From: Dave Brolley Date: Mon, 4 May 2009 16:05:22 -0400 Subject: Module signing and verification using a separate file for the module signature. --- util.cxx | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'util.cxx') 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& tokens, -- cgit