From b3a5ec5c59e2c854a9372e0b44bc50db4d755b84 Mon Sep 17 00:00:00 2001 From: Ezra Peisach Date: Sun, 25 Jan 2009 16:44:02 +0000 Subject: [PATCH] Use a struct in_addr to insure alignment of address - instead of random alignment on the stack. Solaris 2.10 has issues if the address is not aligned. The rest of the code in the tree uses a struct in_addr or mallocs the address - which will be sufficiently aligned. ticket: 6308 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21794 dc483132-0cff-0310-8789-dd5450dbe970 --- src/tests/resolve/resolve.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tests/resolve/resolve.c b/src/tests/resolve/resolve.c index 62768af26..47fd6bd06 100644 --- a/src/tests/resolve/resolve.c +++ b/src/tests/resolve/resolve.c @@ -78,7 +78,7 @@ main(argc, argv) { char myname[MAXHOSTNAMELEN+1]; char *ptr; - char addrcopy[4]; + struct in_addr addrcopy; struct hostent *host; int quiet = 0; @@ -124,10 +124,10 @@ main(argc, 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); + memcpy(&addrcopy.s_addr, ptr, 4); /* Convert back to full name */ - if((host = gethostbyaddr(addrcopy, 4, AF_INET)) == NULL) { + if((host = gethostbyaddr(&addrcopy.s_addr, 4, AF_INET)) == NULL) { fprintf(stderr, "Error looking up IP address - fatal\n"); exit(2); } -- 2.26.2