commit 8b9724602a75cb59611bfa43d88ba71f81588125
Author: Elan Ruusamäe <[email protected]>
Date:   Wed Nov 20 12:24:43 2013 +0200

    filter_ns: always add dead processes

 lib/functions | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/lib/functions b/lib/functions
index f7af7de..56cab80 100644
--- a/lib/functions
+++ b/lib/functions
@@ -534,11 +534,17 @@ filter_ns() {
        [ "$cur_ns" ] || return 1
 
        local pid ns pids=""
+       # add pids if it matches current pid namespace
+       # we should add pids what do not exist (dead processes),
+       # but not add pids whose namespace does not match
+       # (processes belonging to different NS do exist in /proc)
        for pid in "$@"; do
+               if [ ! -d /proc/$pid ]; then
+                       pids="$pids $pid"
+                       continue
+               fi
                ns=$(resolvesymlink /proc/$pid/ns/pid)
-               # add if matches current pid namespace
-               # also add if empty ns found (for dead pids?) FIXME
-               if [ -z "$ns" -o "$ns" = "$cur_ns" ]; then
+               if [ "$ns" = "$cur_ns" ]; then
                        pids="$pids $pid"
                fi
        done
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/rc-scripts.git/commitdiff/8b9724602a75cb59611bfa43d88ba71f81588125

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to