[ovs-dev,v3] ovs-tcpdump: add dump_cmd checker before _doexec()

Message ID 3ee81795-5dbb-496a-a26b-eb8e142d381a.txfh2007@aliyun.com
State New
Headers show
  • [ovs-dev,v3] ovs-tcpdump: add dump_cmd checker before _doexec()
Related show

Commit Message

Anand Kumar via dev March 8, 2019, 7:32 a.m.
Hi Aaron:
    Thanks for your kinkdly suggession. I have tried your proposol and test in my repository. This is the new version.

    Add dump_cmd executable checker in ovs-tcpdump

    Signed-off-by: Liu Chang <txfh2007@aliyun.com>


0-day Robot March 8, 2019, 7:59 a.m. | #1
Bleep bloop.  Greetings txfh2007 via dev, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.

ERROR: Author should not be mailing list.
Lines checked: 45, Warnings: 0, Errors: 1

Please check this out.  If you feel there has been an error, please email aconole@bytheb.org

0-day Robot


diff --git a/utilities/ovs-tcpdump.in b/utilities/ovs-tcpdump.in
index 269c252..911c608 100755
--- a/utilities/ovs-tcpdump.in
+++ b/utilities/ovs-tcpdump.in
@@ -371,6 +371,9 @@  def argv_tuples(lst):
     except StopIteration:

+def py_which(executable):
+        return any(os.access(os.path.join(path,executable),os.X_OK)
+                for path in os.environ["PATH"].split(os.pathsep))

 def main():
     db_sock = 'unix:@RUNDIR@/db.sock'
@@ -416,6 +419,10 @@  def main():
         print("Error: must at least specify an interface with '-i' option")

+    if not py_which(dump_cmd):
+        print("Error: unable to execute '%s' (check PATH)"%dump_cmd)
+        sys.exit(1)
     if '-l' not in tcpdargs:
         tcpdargs.insert(0, '-l')