From 341e263e0371b7d2157353aebd02af5cd1a54b0f Mon Sep 17 00:00:00 2001
From: Brian Warner <warner@lothar.com>
Date: Tue, 28 Apr 2015 11:03:12 -0700
Subject: [PATCH] control.py: minor improvements

refs ticket:1737
---
 src/allmydata/control.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/allmydata/control.py b/src/allmydata/control.py
index a78daf62..7bd8eeda 100644
--- a/src/allmydata/control.py
+++ b/src/allmydata/control.py
@@ -61,7 +61,8 @@ class ControlServer(Referenceable, service.Service):
         return self.parent.debug_wait_for_client_connections(num_clients)
 
     def remote_upload_random_data_from_file(self, size, convergence):
-        filename = tempfile.NamedTemporaryFile(delete=False).name
+        tempdir = tempfile.mkdtemp()
+        filename = os.path.join(tempdir, "data")
         f = open(filename, "wb")
         block = "a" * 8192
         while size > 0:
@@ -75,6 +76,7 @@ class ControlServer(Referenceable, service.Service):
         d.addCallback(lambda results: results.get_uri())
         def _done(uri):
             os.remove(filename)
+            os.rmdir(tempdir)
             return uri
         d.addCallback(_done)
         return d
-- 
2.45.2