diff options
author | tjr <tjr@FreeBSD.org> | 2003-09-28 09:45:56 +0000 |
---|---|---|
committer | tjr <tjr@FreeBSD.org> | 2003-09-28 09:45:56 +0000 |
commit | c0b2688791f0aeed88cfaf2ca398efc7e9ace231 (patch) | |
tree | 0cfff4304e38d2fa9e70bcb9c8f43bc3e3f5450a /usr.bin/talk | |
parent | fb7a83099d94d9780599773b5509a26ed37fd1af (diff) | |
download | FreeBSD-src-c0b2688791f0aeed88cfaf2ca398efc7e9ace231.zip FreeBSD-src-c0b2688791f0aeed88cfaf2ca398efc7e9ace231.tar.gz |
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
Diffstat (limited to 'usr.bin/talk')
-rw-r--r-- | usr.bin/talk/ctl.c | 6 | ||||
-rw-r--r-- | usr.bin/talk/look_up.c | 7 |
2 files changed, 11 insertions, 2 deletions
diff --git a/usr.bin/talk/ctl.c b/usr.bin/talk/ctl.c index 3da8e79..2597a43 100644 --- a/usr.bin/talk/ctl.c +++ b/usr.bin/talk/ctl.c @@ -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); diff --git a/usr.bin/talk/look_up.c b/usr.bin/talk/look_up.c index d251e1c..6c40933 100644 --- a/usr.bin/talk/look_up.c +++ b/usr.bin/talk/look_up.c @@ -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) { |