From ac817c1fc37bd7e831b33f32028005b612eb76eb Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Tue, 10 Jun 2014 22:55:54 +0200 Subject: Print userfriendly message if not root Closes: #751088 --- whatmaps/command.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'whatmaps') 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//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), -- cgit v1.2.3