* pipe.cc (fhandler_pipe::fixup_after_fork): New method.
* fhandler.h (fhandler_pipe::fixup_after_fork): Declare new method.
This commit is contained in:
parent
e19332c667
commit
a1dc0932f4
|
@ -1,3 +1,8 @@
|
||||||
|
Fri Sep 28 21:18:50 2001 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
|
* pipe.cc (fhandler_pipe::fixup_after_fork): New method.
|
||||||
|
* fhandler.h (fhandler_pipe::fixup_after_fork): Declare new method.
|
||||||
|
|
||||||
Fri Sep 28 03:23:04 2001 Christopher Faylor <cgf@cygnus.com>
|
Fri Sep 28 03:23:04 2001 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
* passwd.cc (read_etc_passwd): Bother with unlocking when not
|
* passwd.cc (read_etc_passwd): Bother with unlocking when not
|
||||||
|
|
|
@ -452,6 +452,7 @@ public:
|
||||||
int close ();
|
int close ();
|
||||||
void create_guard (SECURITY_ATTRIBUTES *sa) {guard = CreateMutex (sa, FALSE, NULL);}
|
void create_guard (SECURITY_ATTRIBUTES *sa) {guard = CreateMutex (sa, FALSE, NULL);}
|
||||||
int dup (fhandler_base *child);
|
int dup (fhandler_base *child);
|
||||||
|
void fixup_after_fork (HANDLE);
|
||||||
bool hit_eof ();
|
bool hit_eof ();
|
||||||
friend int make_pipe (int fildes[2], unsigned int psize, int mode);
|
friend int make_pipe (int fildes[2], unsigned int psize, int mode);
|
||||||
};
|
};
|
||||||
|
|
|
@ -63,9 +63,7 @@ int fhandler_pipe::close ()
|
||||||
if (guard)
|
if (guard)
|
||||||
CloseHandle (guard);
|
CloseHandle (guard);
|
||||||
if (writepipe_exists)
|
if (writepipe_exists)
|
||||||
{debug_printf ("writepipe_exists closed");
|
|
||||||
CloseHandle (writepipe_exists);
|
CloseHandle (writepipe_exists);
|
||||||
}
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,6 +81,16 @@ fhandler_pipe::hit_eof ()
|
||||||
return ev == NULL;
|
return ev == NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
fhandler_pipe::fixup_after_fork (HANDLE parent)
|
||||||
|
{
|
||||||
|
this->fhandler_base::fixup_after_fork (parent);
|
||||||
|
if (guard)
|
||||||
|
fork_fixup (parent, guard, "guard");
|
||||||
|
if (writepipe_exists)
|
||||||
|
fork_fixup (parent, writepipe_exists, "guard");
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
fhandler_pipe::dup (fhandler_base *child)
|
fhandler_pipe::dup (fhandler_base *child)
|
||||||
{
|
{
|
||||||
|
@ -96,14 +104,20 @@ fhandler_pipe::dup (fhandler_base *child)
|
||||||
ftp->guard = NULL;
|
ftp->guard = NULL;
|
||||||
else if (!DuplicateHandle (hMainProc, guard, hMainProc, &ftp->guard, 0, 1,
|
else if (!DuplicateHandle (hMainProc, guard, hMainProc, &ftp->guard, 0, 1,
|
||||||
DUPLICATE_SAME_ACCESS))
|
DUPLICATE_SAME_ACCESS))
|
||||||
return -1;
|
{
|
||||||
|
debug_printf ("couldn't duplicate guard %p, %E", guard);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (writepipe_exists == NULL)
|
if (writepipe_exists == NULL)
|
||||||
ftp->writepipe_exists = NULL;
|
ftp->writepipe_exists = NULL;
|
||||||
else if (!DuplicateHandle (hMainProc, writepipe_exists, hMainProc,
|
else if (!DuplicateHandle (hMainProc, writepipe_exists, hMainProc,
|
||||||
&ftp->writepipe_exists, 0, 1,
|
&ftp->writepipe_exists, 0, 1,
|
||||||
DUPLICATE_SAME_ACCESS))
|
DUPLICATE_SAME_ACCESS))
|
||||||
return -1;
|
{
|
||||||
|
debug_printf ("couldn't duplicate writepipe_exists %p, %E", writepipe_exists);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
ftp->id = id;
|
ftp->id = id;
|
||||||
ftp->orig_pid = orig_pid;
|
ftp->orig_pid = orig_pid;
|
||||||
|
|
Loading…
Reference in New Issue