diff options
author | Guido Günther <agx@sigxcpu.org> | 2014-06-10 22:55:54 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2014-06-10 22:57:00 +0200 |
commit | ac817c1fc37bd7e831b33f32028005b612eb76eb (patch) | |
tree | 4fc2c6f01f334425f3218ae3a2fa5a623f4f6809 /whatmaps | |
parent | ff00878ff13d3e38306cf05b3bd5dcda19a4cc7a (diff) |
Print userfriendly message if not root
Closes: #751088
Diffstat (limited to 'whatmaps')
-rwxr-xr-x | whatmaps/command.py | 10 |
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), |