Op Sat, 4 Sep 2004 23:51:25 -0500 (CDT) schreef Christopher Faylor in <[EMAIL PROTECTED]>:
[...] : - Fix some problems with rsync hangs on Windows NT class systems. (Bob Byrnes) This fix trips on a bug in (my) windows 95 (OSR2): It's CreateNamedPipe returns 0 instead of -1 (INVALID_HANDLE_VALUE), causing all operations on pipes to fail. Testcase: (Read on below.) (Somebody else with windows 95, please confirm this reports 'Handle 0, Error 120'.) ==== Begin mktpipe.sh ==== #!/bin/bash cd /tmp cat -<<'EOP' >tpipe.c #include <windows.h> #include <stdio.h> main(){ HANDLE read_pipe; DWORD errnum; SetLastError(0); read_pipe = CreateNamedPipe ("\\\\.\\pipe\\testpipe-1", PIPE_ACCESS_INBOUND, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE, 1, /* max instances */ 16384, /* output buffer size */ 14384, /* input buffer size */ NMPWAIT_USE_DEFAULT_WAIT, NULL); if (read_pipe == INVALID_HANDLE_VALUE || !read_pipe) { printf("Handle %d, Error %d\n", read_pipe, GetLastError()); } else { printf("No error, read handle: %d\n", read_pipe); CloseHandle(read_pipe); } } EOP gcc -o tpipe.exe tpipe.c ./tpipe rm tpipe.c tpipe.exe ===== End mktpipe.sh ===== A patch to work around this in cygwin could be: (WFM) ==== Begin pipe-w95.diff ==== --- src/winsup/cygwin/pipe.cc 3 Sep 2004 01:32:02 -0000 1.62 +++ src/winsup/cygwin/pipe.cc 7 Sep 2004 19:09:55 -0000 @@ -259,6 +259,7 @@ create_selectable_pipe (PHANDLE read_pip the pipe was not created earlier by some other process, even if the pid has been reused. We avoid FILE_FLAG_FIRST_PIPE_INSTANCE because that is only available for Win2k SP2 and WinXP. */ + SetLastError(0); read_pipe = CreateNamedPipe (pipename, PIPE_ACCESS_INBOUND, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE, @@ -268,13 +269,13 @@ create_selectable_pipe (PHANDLE read_pip NMPWAIT_USE_DEFAULT_WAIT, sa_ptr); - if (read_pipe != INVALID_HANDLE_VALUE) + DWORD err = GetLastError (); + if ((read_pipe || !err) && read_pipe != INVALID_HANDLE_VALUE) { debug_printf ("pipe read handle %p", read_pipe); break; } - DWORD err = GetLastError (); switch (err) { case ERROR_PIPE_BUSY: ===== End pipe-w95.diff ===== I hope this patch is small enough to qualify as `trivial', as I haven't received any reply to my legal query (yet). (Did the reply get blocked from the list?) ChangeLog-entry: 08-09-2004 Bas van Gompel <[EMAIL PROTECTED]> * pipe.cc: (create_selectable_pipe) Work around bug in windows 95 where CreateNamedPipe returns zero. [...] HTH, Buzz. -- ) | | ---/ ---/ Yes, this | This message consists of true | I do not -- | | / / really is | and false bits entirely. | mail for ) | | / / a 72 by 4 +-------------------------------+ any1 but -- \--| /--- /--- .sigfile. | |perl -pe "s.u(z)\1.as." | me. 4^re -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/