diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2017-03-27 13:23:52 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2017-03-27 13:23:52 +0100 |
commit | 3a0e2c3a9c2d5a76fc427dcff83aeff4b38b36e0 (patch) | |
tree | 55c7b9f3261ca37407caaf0974bfb96ea2513bd8 | |
parent | 3ae6267399e77bed7d15ac32564dde21ea877ad1 (diff) | |
download | sos-3a0e2c3a9c2d5a76fc427dcff83aeff4b38b36e0.tar.gz |
[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 <bmr@redhat.com>
-rw-r--r-- | sos/sosreport.py | 2 |
1 files changed, 1 insertions, 1 deletions
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 |