diff options
-rw-r--r-- | sos/sosreport.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sos/sosreport.py b/sos/sosreport.py index 88c67301..3fb60c70 100644 --- a/sos/sosreport.py +++ b/sos/sosreport.py @@ -534,6 +534,12 @@ class SoSReport(object): self.policy = sos.policies.load() self._is_root = self.policy.is_root() self.tmpdir = self.policy.get_tmp_dir(self.opts.tmp_dir) + if not os.path.isdir(self.tmpdir) \ + or not os.access(self.tmpdir, os.W_OK): + # write directly to stderr as logging is not initialised yet + sys.stderr.write("temporary directory %s " % self.tmpdir \ + + "does not exist or is not writable\n") + self._exit(1) self.tempfile_util = TempFileUtil(self.tmpdir) self._set_directories() |