On Thu, Dec 22, 2016 at 11:40 AM, Andrii Kroitor <an.kroi...@samsung.com> wrote: > On 22.12.16 15:00, Gustavo Sverzut Barbieri wrote: >> On Thu, Dec 22, 2016 at 10:27 AM, Andrii Kroitor <an.kroi...@samsung.com> >> wrote: >>> lorddrew pushed a commit to branch master. >>> >>> http://git.enlightenment.org/core/efl.git/commit/?id=11e687578dca47f024dc230f2d23c579ddd91961 >>> >>> commit 11e687578dca47f024dc230f2d23c579ddd91961 >>> Author: Andrii Kroitor <an.kroi...@samsung.com> >>> Date: Thu Dec 22 14:10:10 2016 +0200 >>> >>> ecore_exe: fix send on Windows >>> >>> Check for bytes written only if more than 0 bytes were sent. >>> I don't know why some efl code is trying to send 0 bytes, but that >>> works on >>> Linux and therefore should be fixed on Windows. >>> --- >>> src/lib/ecore/ecore_exe_win32.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/src/lib/ecore/ecore_exe_win32.c >>> b/src/lib/ecore/ecore_exe_win32.c >>> index 305298e..3532fe1 100644 >>> --- a/src/lib/ecore/ecore_exe_win32.c >>> +++ b/src/lib/ecore/ecore_exe_win32.c >>> @@ -560,7 +560,7 @@ _impl_ecore_exe_send(Ecore_Exe *obj, >>> BOOL res; >>> >>> res = WriteFile(exe->pipe_write.child_pipe_x, data, size, &num_exe, >>> NULL); >>> - if (!res || num_exe == 0) >>> + if (size && !res || num_exe == 0) >> eventually apps don't check what they try to send... but the library >> should, then don't try to send, the WriteFile with zero-size is not >> right. >> > I've experimented with adding abort() on sending zero bytes and this > leads to segfault on `elementary_test -to Thumb` on Linux. > So EFL code itself is actually trying to send 0 bytes to child process. > I'm wondering is there any reason to do this on Linux?
I bet it's a bug in upper layers. But we shouldn't try to write zero bytes. Also, see the Linux manpage write(2): If count is zero and fd refers to a regular file, then write() may return a failure status if one of the errors below is detected. If no errors are detected, or error detection is not performed, 0 will be returned without causing any other effect. If count is zero and fd refers to a file other than a regular file, the results are not speciā fied. We're talking about non-regular file, thus the second case, which means unspecified. TL;DR: before WriteFile() or write() we should check: EINA_SAFETY_ON_TRUE_RETURN_VAL(size == 0, ...); -- Gustavo Sverzut Barbieri -------------------------------------- Mobile: +55 (16) 99354-9890 ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today.http://sdm.link/intel _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel