From 3a0e2c3a9c2d5a76fc427dcff83aeff4b38b36e0 Mon Sep 17 00:00:00 2001 From: "Bryn M. Reeves" Date: Mon, 27 Mar 2017 13:23:52 +0100 Subject: [sosreport] open temporary files for reading and writing Open files created by the TempFileUtil class for both reading and writing: this allows the log files that are managed by this class to be read back once they have been written. This will be used to convert logging handlers to StreamHandler. Signed-off-by: Bryn M. Reeves --- sos/sosreport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sos/sosreport.py b/sos/sosreport.py index 65eb29e6..8f9b3f18 100644 --- a/sos/sosreport.py +++ b/sos/sosreport.py @@ -84,7 +84,7 @@ class TempFileUtil(object): def new(self): fd, fname = tempfile.mkstemp(dir=self.tmp_dir) # avoid TOCTOU race by using os.fdopen() - fobj = os.fdopen(fd) + fobj = os.fdopen(fd, 'w+') self.files.append((fname, fobj)) return fobj -- cgit