[PATCH 3/4] use mktemp instead of a fixed directory

Guillem Jover guillem.jover at nokia.com
Mon Nov 3 14:16:51 PST 2008


Create the temporary directory securely.
---
 hald/setup-hald.sh |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hald/setup-hald.sh b/hald/setup-hald.sh
index d6d71d0..9e4a399 100644
--- a/hald/setup-hald.sh
+++ b/hald/setup-hald.sh
@@ -10,13 +10,13 @@ esac
 export HALD_RUNNER_PATH=`pwd`/$backend:`pwd`/$backend/probing:`pwd`/$backend/addons:`pwd`/.:`pwd`/../tools:`pwd`/../tools/$backend
 export PATH=`pwd`/../hald-runner:$PATH
 
-HALD_TMPDIR=/tmp/run-hald-$USER
+HALD_TMPDIR=`mktemp -t -d run-hald-XXXXXXXXXX` || exit 1
+
+chmod 755 $HALD_TMPDIR
 
 if [ "$1" = "--skip-fdi-install" ] ; then
     shift
 else
-    rm -rf $HALD_TMPDIR
-    mkdir -p $HALD_TMPDIR
     make -C ../policy install DESTDIR=$HALD_TMPDIR prefix=/
     make -C ../fdi install DESTDIR=$HALD_TMPDIR prefix=/ && \
     if [ -d $information_fdidir ] ; then
-- 
1.6.0.2



More information about the hal mailing list