]> arthur.barton.de Git - backup-script.git/commitdiff
backup-script-wrapper: Use "mktemp" to generate temporary file
authorAlexander Barton <alex@barton.de>
Thu, 24 Jul 2014 09:13:33 +0000 (11:13 +0200)
committerAlexander Barton <alex@barton.de>
Thu, 24 Jul 2014 09:13:53 +0000 (11:13 +0200)
This is much saver and generates correctly restricted permissions.

bin/backup-script-wrapper

index d069670bde80aa0dc253a37d8bc0b42618bcbdcd..282a9c9b16ad43b8f95eedb0b652eeb7e42fd536 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 #
 # backup-script system for cloning systems using rsync
-# Copyright (c)2008-2013 Alexander Barton, alex@barton.de
+# Copyright (c)2008-2014 Alexander Barton, alex@barton.de
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -14,7 +14,7 @@
 
 NAME="backup-script"
 HOST=`hostname`
-TMP="/tmp/$NAME.$$"
+TMP=`mktemp /tmp/$NAME.XXXXXXXX` || exit 11
 
 PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
 export PATH