aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2018-05-30 13:00:54 -0300
committerSilvio Rhatto <rhatto@riseup.net>2018-05-30 13:00:54 -0300
commitae3c0b175a293a689d876ed0b5d6b29af4a4012c (patch)
tree83f5eaaebef57eda1bbc12e8c7920fb800740e13
parent299cdf52679f17dee6a61a0da3e4cfd7e1a39808 (diff)
downloadkeyringer-ae3c0b175a293a689d876ed0b5d6b29af4a4012c.tar.gz
keyringer-ae3c0b175a293a689d876ed0b5d6b29af4a4012c.tar.bz2
Cleanup mktemp target at keyringer_shred
-rwxr-xr-xlib/keyringer/functions10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/keyringer/functions b/lib/keyringer/functions
index 6fc82e7..9f67fc9 100755
--- a/lib/keyringer/functions
+++ b/lib/keyringer/functions
@@ -192,14 +192,15 @@ function keyringer_shred {
return
fi
+ # Create our test target
+ _F="$(mktemp)"
+
# Get shred implementation
if which wipe &> /dev/null; then
tool="wipe"
elif which shred &> /dev/null; then
tool="shred"
- elif which gshred &> /dev/null; then
- tool="gshred"
- elif _F=$(mktemp); rm -P "${_F}" &> /dev/null; then
+ elif rm -P "${_F}" &> /dev/null; then
tool="rm -P"
else
# Worst implementation
@@ -207,6 +208,9 @@ function keyringer_shred {
tool="rm"
fi
+ # Cleanup in case "rm -P" is never called or -P flag is unsupported
+ rm -f "${_F}"
+
echo "$message $path using $tool..."
if [ -d "$path" ]; then