]> git.ipfire.org Git - thirdparty/mtr.git/commitdiff
fix #204 : added exec of mtr-packet in the place where mtr was started from. Quick...
authorR.E. Wolff <R.E.Wolff@BitWizard.nl>
Sun, 18 Jun 2017 10:45:16 +0000 (12:45 +0200)
committerR.E. Wolff <R.E.Wolff@BitWizard.nl>
Sun, 18 Jun 2017 10:45:16 +0000 (12:45 +0200)
ui/cmdpipe.c
ui/mtr.c

index c7120e2cb1ea787bddf9e1e61856feddb30cf8ba..a90fa4fc74836c7f70e384cc55e73913f36cd12b 100644 (file)
@@ -204,6 +204,7 @@ int check_packet_features(
 }
 
 
+extern char *myname;
 /*
     Execute mtr-packet, allowing the MTR_PACKET evironment to override
     the PATH when locating the executable.
@@ -212,6 +213,7 @@ static
 void execute_packet_child(
     void)
 {
+    char buf[256];
     /*
        Allow the MTR_PACKET environment variable to override
        the path to the mtr-packet executable.  This is necessary
@@ -228,6 +230,14 @@ void execute_packet_child(
      */
     execlp(mtr_packet_path, "mtr-packet", (char *) NULL);
 
+    /* 
+       Then try to find it where WE were executed from.  
+     */
+    strncpy (buf, myname, 240);
+    strcat (buf, "-packet");
+    mtr_packet_path = buf;
+    execl(mtr_packet_path, "mtr-packet", (char *) NULL);
+
     /*
        If mtr-packet is not found, try to use mtr-packet from current directory
      */
index 70ae5c4786ece6ea2d27e0f88fd260d6d9eafb92..1f4afd678c8463f09e0a43226ae7bbc77315e9e9 100644 (file)
--- a/ui/mtr.c
+++ b/ui/mtr.c
@@ -70,6 +70,8 @@
 #endif
 
 
+char *myname;
+
 const struct fields data_fields[MAXFLD] = {
     /* key, Remark, Header, Format, Width, CallBackFunc */
     {' ', "<sp>: Space between fields", " ", " ", 1, &net_drop},
@@ -697,6 +699,7 @@ int main(
     names_t *names_head = NULL;
     names_t *names_walk;
 
+    myname = argv[0];
     struct mtr_ctl ctl;
     memset(&ctl, 0, sizeof(ctl));
     /* initialize non-null values */