[PATCH 2/5] abrt-python: pass DD_OPEN_READONLY only if available

Richard Marko rmarko at redhat.com
Thu May 9 13:44:06 UTC 2013


Signed-off-by: Richard Marko <rmarko at redhat.com>
---
 src/python-problem/problem/proxies.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/python-problem/problem/proxies.py b/src/python-problem/problem/proxies.py
index d4b3cfa..c547161 100644
--- a/src/python-problem/problem/proxies.py
+++ b/src/python-problem/problem/proxies.py
@@ -155,13 +155,15 @@ class FsProxy(object):
     def get_item(self, dump_dir, name):
         ddir = self._open_ddir(dump_dir)
 
-        val = ddir.load_text(
-            name,
-            report.DD_OPEN_READONLY |
-            report.DD_FAIL_QUIETLY_EACCES |
+        flags = (report.DD_FAIL_QUIETLY_EACCES |
             report.DD_FAIL_QUIETLY_ENOENT |
             report.DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE)
 
+        if hasattr(report, 'DD_OPEN_READONLY'):
+            flags |= report.DD_OPEN_READONLY
+
+        val = ddir.load_text(name, flags)
+
         ddir.close()
         return val
 
-- 
1.8.1.4



More information about the Crash-catcher mailing list