efl_io and efl_net examples: fix O_CLOEXEC on windows.
use the efl_io_closer_close_on_exec_set() to use a simple boolean instead of a flag that may be undefined on some platforms, such as windows.
This commit is contained in:
parent
349b106125
commit
388ec0fb62
|
@ -504,7 +504,8 @@ main(int argc, char **argv)
|
|||
/* regular file, open with flags: read-only and close-on-exec */
|
||||
input = efl_add(EFL_IO_FILE_CLASS, NULL,
|
||||
efl_file_set(efl_added, input_fname, NULL), /* mandatory */
|
||||
efl_io_file_flags_set(efl_added, O_RDONLY | O_CLOEXEC), /* recommended */
|
||||
efl_io_file_flags_set(efl_added, O_RDONLY), /* default */
|
||||
efl_io_closer_close_on_exec_set(efl_added, EINA_TRUE), /* recommended, set *after* flags, or include O_CLOEXEC in flags -- be careful with _WIN32 that doesn't support it. */
|
||||
efl_event_callback_array_add(efl_added, input_cbs(), NULL) /* optional */
|
||||
);
|
||||
if (!input)
|
||||
|
@ -664,7 +665,8 @@ main(int argc, char **argv)
|
|||
*/
|
||||
output = efl_add(EFL_IO_FILE_CLASS, NULL,
|
||||
efl_file_set(efl_added, output_fname, NULL), /* mandatory */
|
||||
efl_io_file_flags_set(efl_added, O_WRONLY | O_CLOEXEC | O_CREAT | O_TRUNC), /* mandatory for write */
|
||||
efl_io_file_flags_set(efl_added, O_WRONLY | O_CREAT | O_TRUNC), /* mandatory for write */
|
||||
efl_io_closer_close_on_exec_set(efl_added, EINA_TRUE), /* recommended, set *after* flags, or include O_CLOEXEC in flags -- be careful with _WIN32 that doesn't support it. */
|
||||
efl_io_file_mode_set(efl_added, 0644), /* mandatory for write */
|
||||
efl_event_callback_array_add(efl_added, output_cbs(), NULL) /* optional */
|
||||
);
|
||||
|
|
|
@ -290,7 +290,8 @@ main(int argc, char **argv)
|
|||
input = efl_add(EFL_IO_FILE_CLASS, loop,
|
||||
efl_name_set(efl_added, "input"),
|
||||
efl_file_set(efl_added, input_fname, NULL),
|
||||
efl_io_file_flags_set(efl_added, O_RDONLY | O_CLOEXEC),
|
||||
efl_io_file_flags_set(efl_added, O_RDONLY),
|
||||
efl_io_closer_close_on_exec_set(efl_added, EINA_TRUE), /* recommended, set *after* flags, or include O_CLOEXEC in flags -- be careful with _WIN32 that doesn't support it. */
|
||||
efl_event_callback_add(efl_added, EFL_IO_READER_EVENT_EOS, _eos, NULL));
|
||||
}
|
||||
|
||||
|
@ -305,7 +306,8 @@ main(int argc, char **argv)
|
|||
efl_name_set(efl_added, "output"),
|
||||
efl_file_set(efl_added, output_fname, NULL),
|
||||
efl_io_file_mode_set(efl_added, 0644),
|
||||
efl_io_file_flags_set(efl_added, O_WRONLY | O_CLOEXEC | O_TRUNC | O_CREAT));
|
||||
efl_io_file_flags_set(efl_added, O_WRONLY | O_TRUNC | O_CREAT),
|
||||
efl_io_closer_close_on_exec_set(efl_added, EINA_TRUE)); /* recommended, set *after* flags, or include O_CLOEXEC in flags -- be careful with _WIN32 that doesn't support it. */
|
||||
}
|
||||
|
||||
primary_mode = _parse_primary_mode(primary_mode_str);
|
||||
|
|
Loading…
Reference in New Issue