From 86adcf005abc7880d26227ab759c1a4b969018b8 Mon Sep 17 00:00:00 2001 From: Michal Sekletar Date: Sun, 4 Aug 2013 23:54:03 +0200 Subject: [PATCH] sources: commit forgotten patch --- mtr-default-hostname.patch | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 mtr-default-hostname.patch diff --git a/mtr-default-hostname.patch b/mtr-default-hostname.patch new file mode 100644 index 0000000..b13022d --- /dev/null +++ b/mtr-default-hostname.patch @@ -0,0 +1,45 @@ +From a646775da81a6a80c25b8bc5b26c465786ddfa38 Mon Sep 17 00:00:00 2001 +From: Roger Wolff +Date: Wed, 3 Jul 2013 12:00:28 +0200 +Subject: [PATCH 1/4] fixed default hostname + +--- + mtr.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/mtr.c b/mtr.c +index 75a3b06..fd4705d 100644 +--- a/mtr.c ++++ b/mtr.c +@@ -141,7 +141,8 @@ append_to_names(const char* progname, const char* item) { + fprintf(stderr, "%s: memory allocation failure\n", progname); + exit(EXIT_FAILURE); + } +- name->name = strdup(item); ++ // prepared for adding NULL name, but decided against that in the end. ++ name->name = item?strdup(item):item; + name->next = names; + names = name; + } +@@ -581,13 +582,16 @@ int main(int argc, char **argv) + } + + time_t now = time(NULL); ++ ++ if (!names) append_to_names (argv[0], "localhost"); // default: localhost. ++ + names_t* head = names; + while (names != NULL) { + + Hostname = names->name; +- if (Hostname == NULL) Hostname = "localhost"; ++ // if (Hostname == NULL) Hostname = "localhost"; // no longer necessary. + if (gethostname(LocalHostname, sizeof(LocalHostname))) { +- strcpy(LocalHostname, "UNKNOWNHOST"); ++ strcpy(LocalHostname, "UNKNOWNHOST"); + } + + if (net_preopen_result != 0) { +-- +1.8.3.1 +