From 0dab14e927137f4cb8d311b6cbae77343fa95ee0 Mon Sep 17 00:00:00 2001 From: Libor Pechacek Date: Tue, 22 Dec 2015 12:50:55 +0100 Subject: [PATCH] Handle unknown scheduler policy codes gracefully References: bnc#959992 Prevent unhandled exception upon reading unknown scheduler policy code from /proc//stat. Signed-off-by: Libor Pechacek Signed-off-by: Mike Galbraith --- cpuset/commands/proc.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/cpuset/commands/proc.py +++ b/cpuset/commands/proc.py @@ -727,7 +727,8 @@ options = [make_option('-l', '--list', out2 = [] out2.append(stdict['State'].split()[0]) - out2.append(policy[int(stat[statdef['rtpolicy']])]) + policy_code=int(stat[statdef['rtpolicy']]) + out2.append(policy[policy_code] if policy_code