mirror of
https://github.com/topjohnwu/selinux.git
synced 2024-12-02 16:46:18 +00:00
python: remove IOError in certain cases
In certain cases, IOError caused the much more general exception OSError to be unreachable. Signed-off-by: Elijah Conners <business@elijahpepe.com> Acked-by: Petr Lautrbach <plautrba@redhat.com>
This commit is contained in:
parent
2651989d3b
commit
ebb4a170c0
@ -971,8 +971,8 @@ def do_parser():
|
||||
devnull = os.open(os.devnull, os.O_WRONLY)
|
||||
os.dup2(devnull, sys.stdout.fileno())
|
||||
sys.exit(1)
|
||||
except IOError as e:
|
||||
sys.stderr.write("%s: %s\n" % (e.__class__.__name__, str(e)))
|
||||
except OSError as e:
|
||||
sys.stderr.write("%s: %s\n" % (e.__class__.__name__, e.args[1]))
|
||||
sys.exit(1)
|
||||
except KeyboardInterrupt:
|
||||
sys.exit(0)
|
||||
@ -982,9 +982,6 @@ def do_parser():
|
||||
except KeyError as e:
|
||||
sys.stderr.write("%s: %s\n" % (e.__class__.__name__, e.args[0]))
|
||||
sys.exit(1)
|
||||
except OSError as e:
|
||||
sys.stderr.write("%s: %s\n" % (e.__class__.__name__, e.args[1]))
|
||||
sys.exit(1)
|
||||
except RuntimeError as e:
|
||||
sys.stderr.write("%s: %s\n" % (e.__class__.__name__, e.args[0]))
|
||||
sys.exit(1)
|
||||
|
@ -534,8 +534,6 @@ if __name__ == '__main__':
|
||||
error_exit(error.args[0])
|
||||
except KeyError as error:
|
||||
error_exit(_("Invalid value %s") % error.args[0])
|
||||
except IOError as error:
|
||||
error_exit(error)
|
||||
except KeyboardInterrupt:
|
||||
rc = 0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user