[CRIU] [PATCH 1/4] p.haul: fixing imports and checking 0 length

Adrian Reber adrian at lisas.de
Tue Nov 3 02:16:39 PST 2015


From: Tolik Litovsky <tlitovsk at redhat.com>

Os import was missing.
Zero length exception can be thrown for nameless process

Signed-off-by: Tolik Litovsky <tlitovsk at redhat.com>
---
 webgui/procs.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/webgui/procs.py b/webgui/procs.py
index 662b7f6..1e0eab8 100644
--- a/webgui/procs.py
+++ b/webgui/procs.py
@@ -18,6 +18,7 @@ import flask
 import json
 import psutil
 import time
+import os
 
 from webgui.p_haul_web_gui import APP
 
@@ -44,7 +45,8 @@ def procs():
 
             for p in psutil.process_iter():
                 if callable(p.cmdline):
-                    name = os.path.basename(p.cmdline()[0])
+                    if len(p.cmdline()) > 0:
+                        name = os.path.basename(p.cmdline()[0])
                     if name is '':
                         name = p.name()
                 else:
-- 
1.8.3.1



More information about the CRIU mailing list