]> gitweb.fluxo.info Git - keyringer.git/commitdiff
Cleanup mktemp target at keyringer_shred
authorSilvio Rhatto <rhatto@riseup.net>
Wed, 30 May 2018 16:00:54 +0000 (13:00 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Wed, 30 May 2018 16:00:54 +0000 (13:00 -0300)
lib/keyringer/functions

index 6fc82e71ccd6281d7350124b0239815fc9a7c36e..9f67fc9220ba21dc7e484ca9764471f252318154 100755 (executable)
@@ -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