aboutsummaryrefslogtreecommitdiff
path: root/whatmaps/command.py
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2014-06-10 22:55:54 +0200
committerGuido Günther <agx@sigxcpu.org>2014-06-10 22:57:00 +0200
commitac817c1fc37bd7e831b33f32028005b612eb76eb (patch)
tree4fc2c6f01f334425f3218ae3a2fa5a623f4f6809 /whatmaps/command.py
parentff00878ff13d3e38306cf05b3bd5dcda19a4cc7a (diff)
Print userfriendly message if not root
Closes: #751088
Diffstat (limited to 'whatmaps/command.py')
-rwxr-xr-xwhatmaps/command.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/whatmaps/command.py b/whatmaps/command.py
index 4ca730f..2593398 100755
--- a/whatmaps/command.py
+++ b/whatmaps/command.py
@@ -22,6 +22,7 @@ import glob
import os
import logging
import sys
+import errno
from optparse import OptionParser
try:
import lsb_release
@@ -165,7 +166,14 @@ def main(argv):
logging.debug(" %s", so)
# Find processes that map them
- restart_procs = check_maps(get_all_pids(), shared_objects)
+ try:
+ restart_procs = check_maps(get_all_pids(), shared_objects)
+ except IOError as e:
+ if e.errno == errno.EACCES:
+ logging.error("Can't open process maps in '/proc/<pid>/maps', are you root?")
+ return 1
+ else:
+ raise
logging.debug("Processes that map them:")
for exe, pids in restart_procs.items():
logging.debug(" Exe: %s Pids: %s", exe, pids),