J
Jim Ward
After we installed the latest Solaris patch,
109147-37, the following code fails with an
EFAULT error (14);
int main(int argc, char* argv[])
{
struct sockaddr_in sockaddr;
/* code snipped */
child_sock = accept(serv_sock, (struct sockaddr*) &sockaddr, &addr_size);
/* code snipped */
}
but if I declare sockaddr as a global, everything works:
struct sockaddr_in sockaddr;
int main(int argc, char* argv[])
{
/* code snipped */
child_sock = accept(serv_sock, (struct sockaddr*) &sockaddr, &addr_size);
/* code snipped */
}
I guess the problem has something to do with
byte alignment, but why would a global be properly
aligned and a local improperly aligned?
109147-37, the following code fails with an
EFAULT error (14);
int main(int argc, char* argv[])
{
struct sockaddr_in sockaddr;
/* code snipped */
child_sock = accept(serv_sock, (struct sockaddr*) &sockaddr, &addr_size);
/* code snipped */
}
but if I declare sockaddr as a global, everything works:
struct sockaddr_in sockaddr;
int main(int argc, char* argv[])
{
/* code snipped */
child_sock = accept(serv_sock, (struct sockaddr*) &sockaddr, &addr_size);
/* code snipped */
}
I guess the problem has something to do with
byte alignment, but why would a global be properly
aligned and a local improperly aligned?