version 1.144, 2001/12/06 18:02:32 |
version 1.145, 2001/12/06 18:09:23 |
|
|
* Connect to an inet socket. The DISPLAY value is supposedly |
* Connect to an inet socket. The DISPLAY value is supposedly |
* hostname:d[.s], where hostname may also be numeric IP address. |
* hostname:d[.s], where hostname may also be numeric IP address. |
*/ |
*/ |
strncpy(buf, display, sizeof(buf)); |
strlcpy(buf, display, sizeof(buf)); |
buf[sizeof(buf) - 1] = 0; |
|
cp = strchr(buf, ':'); |
cp = strchr(buf, ':'); |
if (!cp) { |
if (!cp) { |
error("Could not find ':' in DISPLAY: %.100s", display); |
error("Could not find ':' in DISPLAY: %.100s", display); |
|
|
/* Bind it to the name. */ |
/* Bind it to the name. */ |
memset(&sunaddr, 0, sizeof(sunaddr)); |
memset(&sunaddr, 0, sizeof(sunaddr)); |
sunaddr.sun_family = AF_UNIX; |
sunaddr.sun_family = AF_UNIX; |
strncpy(sunaddr.sun_path, auth_sock_name, |
strlcpy(sunaddr.sun_path, auth_sock_name, sizeof(sunaddr.sun_path)); |
sizeof(sunaddr.sun_path)); |
|
|
|
if (bind(sock, (struct sockaddr *) & sunaddr, sizeof(sunaddr)) < 0) |
if (bind(sock, (struct sockaddr *) & sunaddr, sizeof(sunaddr)) < 0) |
packet_disconnect("bind: %.100s", strerror(errno)); |
packet_disconnect("bind: %.100s", strerror(errno)); |