Hostname points to static area which overrides with each gethost*

call, strdup() it.
This commit is contained in:
Andrey A. Chernov 1996-01-19 03:18:50 +00:00
parent 5e26f56623
commit 22cb768412
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=13489

View file

@ -393,7 +393,7 @@ main(argc, argv)
if (hp) {
to->sin_family = hp->h_addrtype;
bcopy(hp->h_addr, (caddr_t)&to->sin_addr, hp->h_length);
hostname = hp->h_name;
hostname = strdup(hp->h_name);
} else {
(void)fprintf(stderr,
"traceroute: unknown host %s\n", *argv);