summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler_socket.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2002-01-01 16:25:31 +0000
committerCorinna Vinschen <corinna@vinschen.de>2002-01-01 16:25:31 +0000
commit2fe2790925a73a7e8e7e7a27c413cd6fefd15e73 (patch)
treea27b61984317b0d26543e3f9ec5a0411cae5c4fd /winsup/cygwin/fhandler_socket.cc
parentb346ae85d61545513c4dea0fe44e5e3dc1524c66 (diff)
downloadcygnal-2fe2790925a73a7e8e7e7a27c413cd6fefd15e73.tar.gz
cygnal-2fe2790925a73a7e8e7e7a27c413cd6fefd15e73.tar.bz2
cygnal-2fe2790925a73a7e8e7e7a27c413cd6fefd15e73.zip
* fhandler.h (fhandler_socket::sun_path): New private member.
(fhandler_socket::set_sun_path): New method. (fhandler_socket::get_sun_path): Ditto. * fhandler_socket.cc (fhandler_socket::fhandler_socket): Initialize sun_path to NULL. (fhandler_socket::~fhandler_socket): Free sun_path if needed. (fhandler_socket::set_sun_path): New method. * net.cc (cygwin_bind): Set sun_path to path of local socket file. (cygwin_getsockname): Add code to return correct sockaddr for unix domain sockets.
Diffstat (limited to 'winsup/cygwin/fhandler_socket.cc')
-rw-r--r--winsup/cygwin/fhandler_socket.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc
index 3d6a13dd4..b62a203bf 100644
--- a/winsup/cygwin/fhandler_socket.cc
+++ b/winsup/cygwin/fhandler_socket.cc
@@ -1,6 +1,6 @@
/* fhandler_socket.cc. See fhandler.h for a description of the fhandler classes.
- Copyright 2000, 2001 Red Hat, Inc.
+ Copyright 2000, 2001, 2002 Red Hat, Inc.
This file is part of Cygwin.
@@ -42,7 +42,7 @@ fhandler_dev_random* entropy_source;
/* fhandler_socket */
fhandler_socket::fhandler_socket ()
- : fhandler_base (FH_SOCKET)
+ : fhandler_base (FH_SOCKET), sun_path (NULL)
{
set_need_fork_fixup ();
prot_info_ptr = (LPWSAPROTOCOL_INFOA) cmalloc (HEAP_BUF,
@@ -53,6 +53,8 @@ fhandler_socket::~fhandler_socket ()
{
if (prot_info_ptr)
cfree (prot_info_ptr);
+ if (sun_path)
+ cfree (sun_path);
}
void
@@ -478,3 +480,11 @@ fhandler_socket::set_close_on_exec (int val)
set_close_on_exec_flag (val);
debug_printf ("set close_on_exec for %s to %d", get_name (), val);
}
+
+void
+fhandler_socket::set_sun_path (const char *path)
+{
+ if (sun_path)
+ cfree (sun_path);
+ sun_path = cstrdup (path);
+}