Mail Archives: cygwin-developers/2000/04/17/09:59:29
>Do you want to submit a patch?
Below is what I did, but it's a little ugly because set_inheritance
is not a fhandler_base method and I stuck cygwin_closesocket in
net.cc because it already defines Win32_Winsock and I didn't want to
introduce that to fhandler.cc ...
Eric
* fhandler.cc (set_inheritance): add dev parameter and special
handling
for FH_SOCKET.
* fhandler.cc (fhandler_base::set_close_on_exec): pass device to
set_inheritance.
* fhandler.h: add dev parameter to set_inheritance definition.
* net.cc (cygwin_closesocket): new function called by
set_inheritance.
diff -urp winsup.orig/cygwin/fhandler.cc winsup/cygwin/fhandler.cc
--- winsup.orig/cygwin/fhandler.cc Sun Apr 09 04:55:14 2000
+++ winsup/cygwin/fhandler.cc Mon Apr 17 15:40:39 2000
@@ -1428,7 +1428,7 @@ fhandler_pipe::lseek (off_t offset, int
}
void __stdcall
-set_inheritance (HANDLE &h, int not_inheriting, const char *name)
+set_inheritance (HANDLE &h, int not_inheriting, const char *name, DWORD
dev)
{
HANDLE newh;
@@ -1438,7 +1438,12 @@ set_inheritance (HANDLE &h, int not_inhe
#ifndef DEBUGGING
else
{
- CloseHandle (h);
+ extern void cygwin_closesocket(HANDLE h);
+
+ if(dev == FH_SOCKET)
+ cygwin_closesocket (h);
+ else
+ CloseHandle (h);
h = newh;
}
#else
@@ -1467,7 +1472,7 @@ fhandler_base::fork_fixup (HANDLE parent
void
fhandler_base::set_close_on_exec (int val)
{
- set_inheritance (io_handle, val);
+ set_inheritance (io_handle, val, NULL, get_device ());
set_close_on_exec_flag (val);
debug_printf ("set close_on_exec for %s to %d", get_name (), val);
}
diff -urp winsup.orig/cygwin/fhandler.h winsup/cygwin/fhandler.h
--- winsup.orig/cygwin/fhandler.h Tue Apr 04 04:55:31 2000
+++ winsup/cygwin/fhandler.h Mon Apr 17 15:22:54 2000
@@ -810,6 +810,7 @@ public:
uid_t __stdcall get_file_owner (int, const char *);
gid_t __stdcall get_file_group (int, const char *);
-void __stdcall set_inheritance (HANDLE &h, int val, const char *name =
NULL);
+void __stdcall set_inheritance (HANDLE &h, int val, const char *name =
NULL,
+ DWORD dev = FH_BAD);
#endif /* _FHANDLER_H_ */
diff -urp winsup.orig/cygwin/net.cc winsup/cygwin/net.cc
--- winsup.orig/cygwin/net.cc Wed Feb 23 04:07:13 2000
+++ winsup/cygwin/net.cc Mon Apr 17 15:24:40 2000
@@ -1622,6 +1622,12 @@ fhandler_socket::close ()
return res;
}
+void
+cygwin_closesocket(HANDLE h)
+{
+ closesocket((SOCKET) h);
+}
+
/* Cygwin internal */
/*
* Return the flags settings for an interface.
- Raw text -