Use the new style struct sockaddr instead of osockaddr in system calls

so that talk works without COMPAT_43.

Obtained from:	NetBSD (christos), Rumi Szabolcs
This commit is contained in:
tjr 2003-09-28 09:45:56 +00:00
parent fb7a83099d
commit c0b2688791
2 changed files with 11 additions and 2 deletions

View File

@ -70,6 +70,9 @@ open_sockt()
{
int length;
(void)memset(&my_addr, 0, sizeof(my_addr));
my_addr.sin_family = AF_INET;
my_addr.sin_len = sizeof(my_addr);
my_addr.sin_addr = my_machine_addr;
my_addr.sin_port = 0;
sockt = socket(AF_INET, SOCK_STREAM, 0);
@ -88,6 +91,9 @@ open_ctl()
{
int length;
(void)memset(&ctl_addr, 0, sizeof(ctl_addr));
ctl_addr.sin_family = AF_INET;
ctl_addr.sin_len = sizeof(my_addr);
ctl_addr.sin_port = 0;
ctl_addr.sin_addr = my_machine_addr;
ctl_sockt = socket(AF_INET, SOCK_DGRAM, 0);

View File

@ -56,6 +56,7 @@ check_local()
{
CTL_RESPONSE response;
CTL_RESPONSE *rp = &response;
struct sockaddr addr;
/* the rest of msg was set up in get_names */
#ifdef MSG_EOR
@ -76,9 +77,11 @@ check_local()
do {
if (rp->addr.sa_family != AF_INET)
p_error("Response uses invalid network address");
(void)memcpy(&addr, &rp->addr.sa_family, sizeof(addr));
addr.sa_family = rp->addr.sa_family;
addr.sa_len = sizeof(addr);
errno = 0;
if (connect(sockt,
(struct sockaddr *)&rp->addr, sizeof (rp->addr)) != -1)
if (connect(sockt, &addr, sizeof(addr)) != -1)
return (1);
} while (errno == EINTR);
if (errno == ECONNREFUSED) {