aboutsummaryrefslogtreecommitdiff
path: root/backupninja
diff options
context:
space:
mode:
authorElijah Saxon <elijah@riseup.net>2005-10-02 12:45:12 +0000
committerElijah Saxon <elijah@riseup.net>2005-10-02 12:45:12 +0000
commit995e34e1663e2448dea174412d58ff03ad32c6cc (patch)
tree9db2343d37c8cacb84a5a15a8db205464d5fd1c5 /backupninja
parentef4bbe3c2bb4af4c2a77e00f2ca0e8971847c0bd (diff)
downloadbackupninja-995e34e1663e2448dea174412d58ff03ad32c6cc.tar.gz
backupninja-995e34e1663e2448dea174412d58ff03ad32c6cc.tar.bz2
created function maketemp, to be used by backupninja
and maildir handler for creating safe temp files.
Diffstat (limited to 'backupninja')
-rwxr-xr-xbackupninja26
1 files changed, 18 insertions, 8 deletions
diff --git a/backupninja b/backupninja
index ea7304e..d653144 100755
--- a/backupninja
+++ b/backupninja
@@ -131,6 +131,23 @@ function setsection() {
CURRENT_SECTION=$1
}
+
+#
+# create a temporary file in a secure way.
+#
+function maketemp() {
+ if [ -x /bin/mktemp ]
+ then
+ local tempfile=`mktemp /tmp/$1.XXXXXXXX`
+ else
+ DATE=`date`
+ sectmp=`echo $DATE | /usr/bin/md5sum | cut -d- -f1`
+ local tempfile=/tmp/$1.$sectmp
+ fi
+ echo $tempfile
+}
+
+
#
# sets a global var with name equal to $1
# to the value of the configuration parameter $1
@@ -305,14 +322,7 @@ function process_action() {
let "actions_run += 1"
# call the handler:
- if [ -x /bin/mktemp ]
- then
- local bufferfile=`mktemp /tmp/backupninja.buffer.XXXXXXXX`
- else
- DATE=`date`
- sectmp=`echo $DATE | /usr/bin/md5sum | cut -d- -f1`
- local bufferfile=/tmp/backupninja.buffer.$sectmp
- fi
+ local bufferfile=`maketemp backupninja.buffer`
echo "" > $bufferfile
echo_debug_msg=1
(