* fhandler.h (fhandler_socket::fixup_after_exec): Remove inline
implementation. (fhandler_dev_raw::fixup_after_exec): Ditto. * fhandler_raw.cc (fhandler_dev_raw::fixup_after_fork): Don't duplicate buffer on fork to avoid memory leak. (fhandler_dev_raw::fixup_after_exec): New implementation equal to former fixup_after_fork() implementation. * fhandler_socket.cc (fhandler_socket::fixup_after_fork): Do nothing when not using Winsock2. (fhandler_socket::fixup_after_exec): New implementation. (fhandler_socket::set_close_on_exec): Never call set_inheritance().
This commit is contained in:
parent
f4e6b76a05
commit
8e54fb88f3
|
@ -1,3 +1,17 @@
|
||||||
|
Thu Sep 20 13:20:00 2001 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* fhandler.h (fhandler_socket::fixup_after_exec): Remove inline
|
||||||
|
implementation.
|
||||||
|
(fhandler_dev_raw::fixup_after_exec): Ditto.
|
||||||
|
* fhandler_raw.cc (fhandler_dev_raw::fixup_after_fork): Don't
|
||||||
|
duplicate buffer on fork to avoid memory leak.
|
||||||
|
(fhandler_dev_raw::fixup_after_exec): New implementation equal to
|
||||||
|
former fixup_after_fork() implementation.
|
||||||
|
* fhandler_socket.cc (fhandler_socket::fixup_after_fork): Do
|
||||||
|
nothing when not using Winsock2.
|
||||||
|
(fhandler_socket::fixup_after_exec): New implementation.
|
||||||
|
(fhandler_socket::set_close_on_exec): Never call set_inheritance().
|
||||||
|
|
||||||
Thu Sep 20 9:55:00 2001 Corinna Vinschen <corinna@vinschen.de>
|
Thu Sep 20 9:55:00 2001 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* fhandler.cc (fhandler_base::set_inheritance): If available,
|
* fhandler.cc (fhandler_base::set_inheritance): If available,
|
||||||
|
|
|
@ -418,7 +418,7 @@ public:
|
||||||
void set_close_on_exec (int val);
|
void set_close_on_exec (int val);
|
||||||
virtual void fixup_before_fork_exec (DWORD);
|
virtual void fixup_before_fork_exec (DWORD);
|
||||||
void fixup_after_fork (HANDLE);
|
void fixup_after_fork (HANDLE);
|
||||||
void fixup_after_exec (HANDLE parent) { fixup_after_fork (parent); }
|
void fixup_after_exec (HANDLE);
|
||||||
|
|
||||||
select_record *select_read (select_record *s);
|
select_record *select_read (select_record *s);
|
||||||
select_record *select_write (select_record *s);
|
select_record *select_write (select_record *s);
|
||||||
|
@ -490,7 +490,7 @@ public:
|
||||||
int ioctl (unsigned int cmd, void *buf);
|
int ioctl (unsigned int cmd, void *buf);
|
||||||
|
|
||||||
void fixup_after_fork (HANDLE);
|
void fixup_after_fork (HANDLE);
|
||||||
void fixup_after_exec (HANDLE parent) { fixup_after_fork (parent); }
|
void fixup_after_exec (HANDLE);
|
||||||
};
|
};
|
||||||
|
|
||||||
class fhandler_dev_floppy: public fhandler_dev_raw
|
class fhandler_dev_floppy: public fhandler_dev_raw
|
||||||
|
|
|
@ -467,6 +467,14 @@ fhandler_dev_raw::dup (fhandler_base *child)
|
||||||
|
|
||||||
void
|
void
|
||||||
fhandler_dev_raw::fixup_after_fork (HANDLE)
|
fhandler_dev_raw::fixup_after_fork (HANDLE)
|
||||||
|
{
|
||||||
|
devbufstart = 0;
|
||||||
|
devbufend = 0;
|
||||||
|
lastblk_to_read = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
fhandler_dev_raw::fixup_after_exec (HANDLE)
|
||||||
{
|
{
|
||||||
if (devbufsiz > 1L)
|
if (devbufsiz > 1L)
|
||||||
devbuf = new char [devbufsiz];
|
devbuf = new char [devbufsiz];
|
||||||
|
|
|
@ -202,13 +202,24 @@ fhandler_socket::fixup_after_fork (HANDLE parent)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
fhandler_base::fixup_after_fork (parent);
|
fhandler_base::fixup_after_fork (parent);
|
||||||
|
#endif
|
||||||
debug_printf ("Without Winsock 2.0");
|
debug_printf ("Without Winsock 2.0");
|
||||||
}
|
}
|
||||||
if (secret_event)
|
if (secret_event)
|
||||||
fork_fixup (parent, secret_event, "secret_event");
|
fork_fixup (parent, secret_event, "secret_event");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
fhandler_socket::fixup_after_exec (HANDLE parent)
|
||||||
|
{
|
||||||
|
if (!get_close_on_exec ())
|
||||||
|
fixup_after_fork (parent);
|
||||||
|
else
|
||||||
|
closesocket (get_socket ());
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
fhandler_socket::dup (fhandler_base *child)
|
fhandler_socket::dup (fhandler_base *child)
|
||||||
{
|
{
|
||||||
|
@ -447,9 +458,11 @@ fhandler_socket::fcntl (int cmd, void *arg)
|
||||||
void
|
void
|
||||||
fhandler_socket::set_close_on_exec (int val)
|
fhandler_socket::set_close_on_exec (int val)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
extern WSADATA wsadata;
|
extern WSADATA wsadata;
|
||||||
if (wsadata.wVersion < 512) /* < Winsock 2.0 */
|
if (wsadata.wVersion < 512) /* < Winsock 2.0 */
|
||||||
set_inheritance (get_handle (), val);
|
set_inheritance (get_handle (), val);
|
||||||
|
#endif
|
||||||
set_close_on_exec_flag (val);
|
set_close_on_exec_flag (val);
|
||||||
debug_printf ("set close_on_exec for %s to %d", get_name (), val);
|
debug_printf ("set close_on_exec for %s to %d", get_name (), val);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue