Cygwin: fhandler_mqueue::mq_open: set all required fhandler flags

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2021-05-25 22:43:41 +02:00
parent fd3fb7a147
commit 2b4c7f90d4
1 changed files with 8 additions and 1 deletions

View File

@ -26,7 +26,6 @@ fhandler_mqueue::fhandler_mqueue () :
fhandler_disk_file () fhandler_disk_file ()
{ {
filebuf = (char *) ccalloc_abort (HEAP_BUF, 1, FILESIZE); filebuf = (char *) ccalloc_abort (HEAP_BUF, 1, FILESIZE);
close_on_exec (true);
} }
fhandler_mqueue::~fhandler_mqueue () fhandler_mqueue::~fhandler_mqueue ()
@ -144,6 +143,14 @@ out:
else else
mqinfo = mqinfo_open (oflags & O_NONBLOCK); mqinfo = mqinfo_open (oflags & O_NONBLOCK);
mq_open_finish (mqinfo != NULL, created); mq_open_finish (mqinfo != NULL, created);
/* Set fhandler open flags */
if (mqinfo)
{
set_access (GENERIC_READ | SYNCHRONIZE);
close_on_exec (true);
set_flags (oflags | O_CLOEXEC, O_BINARY);
set_open_status ();
}
return mqinfo ? 1 : 0; return mqinfo ? 1 : 0;
} }