[PATCH 4/4] vmcore: fail gracefully if dump_dir is not accessible

Richard Marko rmarko at redhat.com
Mon Sep 2 09:27:02 UTC 2013


Previously os.listdir on inaccessible dump_dir resulted
in exception. This replaces insufficient os.path.exists check
(which is already handled in abrt-vmcore.service file) with
os.access call which checks for dir readability.

Signed-off-by: Richard Marko <rmarko at redhat.com>
---
 src/hooks/abrt_harvest_vmcore.py.in | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/hooks/abrt_harvest_vmcore.py.in b/src/hooks/abrt_harvest_vmcore.py.in
index 3951307..ea331c0 100644
--- a/src/hooks/abrt_harvest_vmcore.py.in
+++ b/src/hooks/abrt_harvest_vmcore.py.in
@@ -186,8 +186,10 @@ def harvest_vmcore():
 
     dump_dir = parse_kdump()
 
-    if not os.path.exists(dump_dir):
-        sys.exit(0)
+    if not os.access(dump_dir, os.R_OK):
+        sys.stderr.write("Dump directory '%s' not accessible. "
+                         "Exiting.\n" % dump_dir)
+        sys.exit(1)
 
     # Wait for abrtd to start. Give it at least 1 second to initialize.
     for i in xrange(10):
-- 
1.8.3.1



More information about the Crash-catcher mailing list