summaryrefslogtreecommitdiff
blob: b76fa30f0d08e83be8badace78f3884784b7141c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff -Naur a/etc/shtool b/etc/shtool
--- a/etc/shtool	2005-08-17 14:21:24.000000000 +0200
+++ b/etc/shtool	2005-08-17 14:25:01.000000000 +0200
@@ -378,8 +378,14 @@
             tmpdir="$TEMPDIR"
         fi
     fi
-    tmpfile="$tmpdir/.shtool.$$"
-    rm -f $tmpfile >/dev/null 2>&1
+    if mkdir "$tmpdir/.shtool.$$"; then
+        tmpfile="$tmpdir/.shtool.$$/shtool.tmp"
+    else
+        echo "$msgprefix:Error: failed to create temporary file" 1>&2
+        exit 1
+    fi
+    tmpfile="$tmpdir/.shtool.$$/shtool.tmp"
+    rm -fr "$tmpdir/.shtool.$$" >/dev/null 2>&1 || true
     touch $tmpfile
 fi