Ticket #2051: 0001-Ensure-that-we-close-the-file-descriptors-of-our-tem.patch
| File 0001-Ensure-that-we-close-the-file-descriptors-of-our-tem.patch, 1.0 KB (added by lmacken, 3 years ago) |
|---|
-
journal.py
From d621d2ba6586a48c0c9411426d2eabb1d51a8127 Mon Sep 17 00:00:00 2001 From: Luke Macken <lmacken@redhat.com> Date: Thu, 17 Jun 2010 08:28:58 -0400 Subject: [PATCH] Ensure that we close the file descriptors of our tempfile diff --git a/journal.py b/journal.py index 8505707..7ef47f2 100644
a b 330 330 #file_path = os.path.join(tempfile.gettempdir(), '%i' % time.time()) 331 331 act_root = environ['SUGAR_ACTIVITY_ROOT'] 332 332 tmp_dir = join(act_root, 'data') 333 file_path = str(tempfile.mkstemp(dir=tmp_dir)[1])333 tmp_fd, file_path = tempfile.mkstemp(dir=tmp_dir) 334 334 ###TODO: This is such a crappy way to write a file to the journal 335 335 ### Ideally to be implemented with write_file and read_file methods 336 336 os.chmod(file_path, 0777) … … 365 365 jobject.destroy() 366 366 del jobject 367 367 finally: 368 os.close(tmp_fd) 368 369 os.remove(file_path) 369 370 370 371 """
