[Pkg-privacy-commits] [libgsecuredelete] 118/168: Perform all operations in the temp directory

Ulrike Uhlig u-guest at moszumanska.debian.org
Thu Jul 7 20:06:46 UTC 2016


This is an automated email from the git hooks/post-receive script.

u-guest pushed a commit to branch master
in repository libgsecuredelete.

commit 0950aab2bcb8ede480b9246592b58372269a7daf
Author: Colomban Wendling <ban at herbesfolles.org>
Date:   Fri May 25 01:11:53 2012 +0200

    Perform all operations in the temp directory
    
    Not only create our temporary files in a temp directory but also ask
    `sfill` to use this directory when filling INode space.
    
    This helps not to pollute the user's directory if something goes wrong.
    In the worst case, the user has a single directory to remove.
---
 gsd-sfill-helper.in | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/gsd-sfill-helper.in b/gsd-sfill-helper.in
index 61f674f..78f8cc1 100644
--- a/gsd-sfill-helper.in
+++ b/gsd-sfill-helper.in
@@ -70,6 +70,11 @@ shift $(expr $OPTIND - 1)
 [ $# -eq 1 ] || die "wrong arguments"
 
 
+# do our work in a temp directory so in the worst case if we fail to cleanup we
+# don't leave the user with tons of temp files but a single directory
+dir=$(mktemp -d --tmpdir="$1") || die "failed to create temp directory"
+trap "rm -rf '$dir'" INT QUIT TERM EXIT
+
 
 # wipe inodes, no workaround needed
 if [ -n "$OPT_i" ] || [ -z "$OPT_I" ]; then
@@ -77,14 +82,11 @@ if [ -n "$OPT_i" ] || [ -z "$OPT_I" ]; then
   inode_v=$OPT_v
   [ -z $OPT_i ] && inode_v=
   
-  "$SFILL" $OPT_f -i $OPT_l $inode_v $OPT_z "$1"
+  "$SFILL" $OPT_f -i $OPT_l $inode_v $OPT_z "$dir"
 fi
 
 # wipe disk space, work around for file size limit
 if [ -z "$OPT_i" ]; then
-  dir=$(mktemp -d --tmpdir="$1") || die "failed to create temp directory"
-  trap "rm -rf '$dir'" INT QUIT TERM EXIT
-  
   input=/dev/urandom
   [ -r "$input" ] || input=/dev/zero
   

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/libgsecuredelete.git



More information about the Pkg-privacy-commits mailing list