diff mbox

[ovs-dev,v2,4/4] ovs-tcpdump: Fix error handling when parsing parameter.

Message ID 1479115454-48163-5-git-send-email-nic@opencloud.tech
State Accepted
Headers show

Commit Message

nickcooper-zhangtonghao Nov. 14, 2016, 9:24 a.m. UTC
Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech>
---
 utilities/ovs-tcpdump.in | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Aaron Conole Nov. 14, 2016, 3:39 p.m. UTC | #1
Nick,

nickcooper-zhangtonghao <nic@opencloud.tech> writes:

> Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech>
> ---
>  utilities/ovs-tcpdump.in | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/utilities/ovs-tcpdump.in b/utilities/ovs-tcpdump.in
> index 96aa1e2..d984a39 100755
> --- a/utilities/ovs-tcpdump.in
> +++ b/utilities/ovs-tcpdump.in
> @@ -433,7 +433,9 @@ def main():
>              print(data)
>          raise KeyboardInterrupt
>      except KeyboardInterrupt:
> -        pipes.terminate()
> +        if pipes.poll() is None:
> +            pipes.terminate()
> +

Thanks for the work on this - do you think it would be okay to also add
something like:

sys.exit(pipes.returncode)

Or even:

if pipes.returncode < 0:
   os.kill(os.getpid(), signal.SIGABRT)
else:
   sys.exit(pipes.returncode)

?

Either way, the change you have above should be applied, so:

Acked-by: Aaron Conole <aconole@redhat.com>
diff mbox

Patch

diff --git a/utilities/ovs-tcpdump.in b/utilities/ovs-tcpdump.in
index 96aa1e2..d984a39 100755
--- a/utilities/ovs-tcpdump.in
+++ b/utilities/ovs-tcpdump.in
@@ -433,7 +433,9 @@  def main():
             print(data)
         raise KeyboardInterrupt
     except KeyboardInterrupt:
-        pipes.terminate()
+        if pipes.poll() is None:
+            pipes.terminate()
+
         ovsdb.destroy_mirror(interface, ovsdb.port_bridge(interface))
         ovsdb.destroy_port(mirror_interface, ovsdb.port_bridge(interface))
     except Exception: