From: Ben Pfaff <blp@nicira.com>
Date: Thu, 5 Jul 2012 19:57:16 +0000 (-0700)
Subject: ovs-check-dead-ifs: Tolerate processes that disappear during run.
X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e23fe72d378bc22beb3d4c05b3f1a9cdfac942b;p=openvswitch

ovs-check-dead-ifs: Tolerate processes that disappear during run.

os.listdir("/proc/%d/fd" % pid) throws OSError if 'pid' died since the
list of pids was obtained.

Bug #12375.
Reported-by: Amey Bhide <abhide@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
---

diff --git a/AUTHORS b/AUTHORS
index 47f6ea31..bf8c149d 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -80,6 +80,7 @@ Alan Shieh              ashieh@nicira.com
 Alban Browaeys          prahal@yahoo.com
 Alex Yip                alex@nicira.com
 Alexey I. Froloff       raorn@altlinux.org
+Amey Bhide              abhide@nicira.com
 André Ruß               andre.russ@hybris.com
 Andreas Beckmann        debian@abeckmann.de
 Atzm Watanabe           atzm@stratosphere.co.jp
diff --git a/utilities/ovs-check-dead-ifs.in b/utilities/ovs-check-dead-ifs.in
index 53185d66..9b806ed3 100755
--- a/utilities/ovs-check-dead-ifs.in
+++ b/utilities/ovs-check-dead-ifs.in
@@ -62,7 +62,12 @@ for pid in os.listdir("/proc"):
     except ValueError:
         continue
 
-    for fd in os.listdir("/proc/%d/fd" % pid):
+    try:
+        fds = os.listdir("/proc/%d/fd" % pid)
+    except OSError:
+        continue
+
+    for fd in fds:
         try:
             fd = int(fd)
         except ValueError: