Mail Archives: cygwin-developers/2000/04/17/19:35:56
On Mon, Apr 17, 2000 at 03:58:48PM +0100, Fifer, Eric wrote:
>>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 ...
Hmm. I think you're right though. set_inheritance should be a
fhandler* method. I was debating doing that when I wrote it but
I didn't see a need for it. Now I do.
Does this make sense? It's still a little bogus since the hclose
method does not actually take an argument in the case of a socket
but that's theoretically ok. It may be a future gotcha, though...
cgf
Index: fhandler.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/fhandler.cc,v
retrieving revision 1.12
diff -u -p -r1.12 fhandler.cc
--- fhandler.cc 2000/04/08 04:47:15 1.12
+++ fhandler.cc 2000/04/18 00:32:55
@@ -1427,8 +1427,8 @@ fhandler_pipe::lseek (off_t offset, int
return -1;
}
-void __stdcall
-set_inheritance (HANDLE &h, int not_inheriting, const char *name)
+void
+fhandler_base::set_inheritance (HANDLE &h, int not_inheriting, const char *name)
{
HANDLE newh;
@@ -1438,16 +1438,17 @@ set_inheritance (HANDLE &h, int not_inhe
#ifndef DEBUGGING
else
{
- CloseHandle (h);
+ hclose (h);
h = newh;
}
#else
else if (!name)
{
- CloseHandle (h);
+ hclose (h);
h = newh;
}
else
+ /* FIXME: This won't work with sockets */
{
ForceCloseHandle2 (h, name);
h = newh;
Index: fhandler.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/fhandler.h,v
retrieving revision 1.7
diff -u -p -r1.7 fhandler.h
--- fhandler.h 2000/04/03 18:15:01 1.7
+++ fhandler.h 2000/04/18 00:32:55
@@ -235,6 +235,8 @@ public:
const char *get_win32_name () { return win32_path_name_; }
unsigned long get_namehash () { return namehash_; }
+ virtual void hclose (HANDLE h) {CloseHandle (h);}
+ virtual void set_inheritance (HANDLE &h, int not_inheriting, const char *name = NULL);
/* fixup fd possibly non-inherited handles after fork */
void fork_fixup (HANDLE parent, HANDLE &h, const char *name);
@@ -315,6 +317,7 @@ public:
int ioctl (unsigned int cmd, void *);
off_t lseek (off_t, int) { return 0; }
int close ();
+ void hclose (HANDLE) {close ();}
select_record *select_read (select_record *s);
select_record *select_write (select_record *s);
@@ -809,7 +812,5 @@ 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);
#endif /* _FHANDLER_H_ */
- Raw text -