From: Elan Ruusamäe Date: Wed, 20 Nov 2013 10:24:43 +0000 (+0200) Subject: filter_ns: always add dead processes X-Git-Tag: 0.4.10~12^2 X-Git-Url: http://git.pld-linux.org/?p=projects%2Frc-scripts.git;a=commitdiff_plain;h=8b9724602a75cb59611bfa43d88ba71f81588125 filter_ns: always add dead processes --- diff --git a/lib/functions b/lib/functions index f7af7def..56cab805 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