From: Mark Eichin Date: Wed, 26 Apr 1995 02:18:34 +0000 (+0000) Subject: * resolve.c (main): copy the address sent back by gethostbyname X-Git-Tag: krb5-1.0-beta5~266 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=73e90b94472f3bd752f8bcd35bc31a069beba2af;p=krb5.git * resolve.c (main): copy the address sent back by gethostbyname before calling gethostbyaddr, since the return is *static*. (main): reindent declaration to make add-change-log-entry happy. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5483 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/tests/resolve/ChangeLog b/src/tests/resolve/ChangeLog new file mode 100644 index 000000000..425562260 --- /dev/null +++ b/src/tests/resolve/ChangeLog @@ -0,0 +1,6 @@ +Tue Apr 25 22:16:38 1995 Mark Eichin + + * resolve.c (main): copy the address sent back by gethostbyname + before calling gethostbyaddr, since the return is *static*. + (main): reindent declaration to make add-change-log-entry happy. + diff --git a/src/tests/resolve/resolve.c b/src/tests/resolve/resolve.c index f89ecb136..71a7bc44f 100644 --- a/src/tests/resolve/resolve.c +++ b/src/tests/resolve/resolve.c @@ -59,12 +59,14 @@ char *strchr(); #include +int main(argc, argv) -int argc; -char **argv; + int argc; + char **argv; { char myname[MAXHOSTNAMELEN+1]; char *ptr; + char addrcopy[4]; struct hostent *host; int err; @@ -96,8 +98,10 @@ char **argv; printf("Host address: %d.%d.%d.%d\n", UC(ptr[0]), UC(ptr[1]), UC(ptr[2]), UC(ptr[3])); + memcpy(addrcopy, ptr, 4); + /* Convert back to full name */ - if((host = gethostbyaddr(ptr, 4, AF_INET)) == NULL) { + if((host = gethostbyaddr(addrcopy, 4, AF_INET)) == NULL) { fprintf(stderr, "Error looking up IP address - fatal\n"); exit(2); }