Cygwin: pipes: do not duplicate sec_none{_nih} locally when creating objects
We already fetched the correct SECURITY_ATTRIBUTES at the start of fhandler_pipe::create, so using another SECURITY_ATTRIBUTES object for the mutex and semaphore objects doesn't make much sense. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
c48361ad9e
commit
8985f1c7c4
|
@ -769,11 +769,7 @@ fhandler_pipe::create (fhandler_pipe *fhs[2], unsigned psize, int mode)
|
||||||
unique_id);
|
unique_id);
|
||||||
/* For the read side of the pipe, add a mutex. See raw_read for the
|
/* For the read side of the pipe, add a mutex. See raw_read for the
|
||||||
usage. */
|
usage. */
|
||||||
SECURITY_ATTRIBUTES sa = { .nLength = sizeof (SECURITY_ATTRIBUTES),
|
HANDLE mtx = CreateMutexW (sa, FALSE, NULL);
|
||||||
.lpSecurityDescriptor = NULL,
|
|
||||||
.bInheritHandle = !(mode & O_CLOEXEC)
|
|
||||||
};
|
|
||||||
HANDLE mtx = CreateMutexW (&sa, FALSE, NULL);
|
|
||||||
if (!mtx)
|
if (!mtx)
|
||||||
{
|
{
|
||||||
delete fhs[0];
|
delete fhs[0];
|
||||||
|
@ -786,11 +782,11 @@ fhandler_pipe::create (fhandler_pipe *fhs[2], unsigned psize, int mode)
|
||||||
fhs[0]->set_read_mutex (mtx);
|
fhs[0]->set_read_mutex (mtx);
|
||||||
res = 0;
|
res = 0;
|
||||||
}
|
}
|
||||||
fhs[0]->select_sem = CreateSemaphore (&sa, 0, INT32_MAX, NULL);
|
fhs[0]->select_sem = CreateSemaphore (sa, 0, INT32_MAX, NULL);
|
||||||
if (fhs[0]->select_sem)
|
if (fhs[0]->select_sem)
|
||||||
DuplicateHandle (GetCurrentProcess (), fhs[0]->select_sem,
|
DuplicateHandle (GetCurrentProcess (), fhs[0]->select_sem,
|
||||||
GetCurrentProcess (), &fhs[1]->select_sem,
|
GetCurrentProcess (), &fhs[1]->select_sem,
|
||||||
0, !(mode & O_CLOEXEC), DUPLICATE_SAME_ACCESS);
|
0, sa->bInheritHandle, DUPLICATE_SAME_ACCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
debug_printf ("%R = pipe([%p, %p], %d, %y)", res, fhs[0], fhs[1], psize, mode);
|
debug_printf ("%R = pipe([%p, %p], %d, %y)", res, fhs[0], fhs[1], psize, mode);
|
||||||
|
|
Loading…
Reference in New Issue