* net.cc (get_inet_addr ): Close AF_UNIX socket file after reading.
This commit is contained in:
parent
294f81d78d
commit
6b6a8cefad
|
@ -1,3 +1,7 @@
|
||||||
|
Sat Dec 2 22:26:00 2000 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* net.cc (get_inet_addr ): Close AF_UNIX socket file after reading.
|
||||||
|
|
||||||
Wed Nov 29 18:25:53 2000 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
|
Wed Nov 29 18:25:53 2000 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
|
||||||
|
|
||||||
* cygheap.cc (chgheap_root::operator =): Check root dir properly.
|
* cygheap.cc (chgheap_root::operator =): Check root dir properly.
|
||||||
|
|
|
@ -387,22 +387,26 @@ static int get_inet_addr (const struct sockaddr *in, int inlen,
|
||||||
}
|
}
|
||||||
else if (in->sa_family == AF_UNIX)
|
else if (in->sa_family == AF_UNIX)
|
||||||
{
|
{
|
||||||
sockaddr_in sin;
|
int fd = _open (in->sa_data, O_RDONLY);
|
||||||
char buf[32];
|
|
||||||
|
|
||||||
memset (buf, 0, sizeof buf);
|
|
||||||
int fd = open (in->sa_data, O_RDONLY);
|
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
return 0;
|
return 0;
|
||||||
if (read (fd, buf, sizeof buf) == -1)
|
|
||||||
return 0;
|
int ret = 0;
|
||||||
|
char buf[32];
|
||||||
|
memset (buf, 0, sizeof buf);
|
||||||
|
if (read (fd, buf, sizeof buf) != -1)
|
||||||
|
{
|
||||||
|
sockaddr_in sin;
|
||||||
sin.sin_family = AF_INET;
|
sin.sin_family = AF_INET;
|
||||||
sscanf (buf + strlen (SOCKET_COOKIE), "%hu", &sin.sin_port);
|
sscanf (buf + strlen (SOCKET_COOKIE), "%hu", &sin.sin_port);
|
||||||
sin.sin_port = htons (sin.sin_port);
|
sin.sin_port = htons (sin.sin_port);
|
||||||
sin.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
|
sin.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
|
||||||
*out = sin;
|
*out = sin;
|
||||||
*outlen = sizeof sin;
|
*outlen = sizeof sin;
|
||||||
return 1;
|
ret = 1;
|
||||||
|
}
|
||||||
|
_close (fd);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue