Fix recently introduced parent_pid macro on NetBSD 7.0.
On NetBSD, procfs status file looks like the following.

    n7% cat /proc/$$/status
    zsh 18509 12970 18509 18509 5,8 ctty,sldr 1476344459,639266 0,15575 0,15575 
pause 1000 100,100,0
    n7%

Signed-off-by: YAMAMOTO Takashi <yamam...@ovn.org>
---
 tests/ovs-macros.at | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/ovs-macros.at b/tests/ovs-macros.at
index f3b7c36..b64d8cd 100644
--- a/tests/ovs-macros.at
+++ b/tests/ovs-macros.at
@@ -107,10 +107,10 @@ parent_pid () {
     # Using "ps" is portable to any POSIX system, but busybox "ps" (used in
     # e.g. Alpine Linux) is noncompliant, so we use a Linux-specific approach
     # when it's available.
-    if test ! -e /proc/$1/status; then
-        ps -o ppid= -p $1
-    else
+    if egrep '^PPid:[[:space:]]*[0-9]*$' /proc/$1/status > /dev/null 2>&1; then
         sed -n 's/^PPid:       \([0-9]*\)/\1/p' /proc/$1/status
+    else
+        ps -o ppid= -p $1
     fi
 }
 ]
-- 
2.5.4 (Apple Git-61)

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to