svn rev #21794: trunk/src/tests/resolve/
epeisach@MIT.EDU
epeisach at MIT.EDU
Sun Jan 25 11:44:04 EST 2009
http://src.mit.edu/fisheye/changelog/krb5/?cs=21794
Commit By: epeisach
Log Message:
ticket: 6308
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.
Changed Files:
U trunk/src/tests/resolve/resolve.c
Modified: trunk/src/tests/resolve/resolve.c
===================================================================
--- trunk/src/tests/resolve/resolve.c 2009-01-24 01:27:16 UTC (rev 21793)
+++ trunk/src/tests/resolve/resolve.c 2009-01-25 16:44:02 UTC (rev 21794)
@@ -78,7 +78,7 @@
{
char myname[MAXHOSTNAMELEN+1];
char *ptr;
- char addrcopy[4];
+ struct in_addr addrcopy;
struct hostent *host;
int quiet = 0;
@@ -124,10 +124,10 @@
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);
}
More information about the cvs-krb5
mailing list