GNOME Bugzilla – Bug 500246
Bug fixes for giowin32
Last modified: 2008-08-20 01:31:03 UTC
Please describe the problem: There are a couple of bugs in giowin32 regarding error checking and write support. Steps to reproduce: Actual results: Expected results: Does this happen every time? Other information: nbytes should be signed, so it can grik negative results of system calls. The condition needs to be checked after the thread id, as it may be IN or OUT. See attached patch.
Created attachment 99785 [details] [review] bug fixes for giowin32.
I agree that nbytes obviously should be signed in those cases. Thanks. For the other change, could you please attach some simple test program (a single C source file) that exhibits the problem the patch fixes?
Any program in the GPGME test suite will exhibit the problem, but I don't think GPGME qualifies as a simple test program. :( We use the patch for many years now in the Gpg4Win project, it's absolutely essential, as GPGME uses bidirectional communication over pipes heavily. In particular, we developed the patch when porting GPA to Windows. In fact, the whole "writing" side of giowin32.c was, as far as I recall, added to support GPA (previously, only the read direction was implemented). The extended context of the patch makes the situation crystal clear: - if (win32_channel->thread_id == 0 && (condition & G_IO_IN)) + if (win32_channel->thread_id == 0) { if (condition & G_IO_IN) create_thread (win32_channel, condition, read_thread); else if (condition & G_IO_OUT) create_thread (win32_channel, condition, write_thread); } Note that the "else" branch inside the outer if-block is currently dead code, and only activated by the patch. The patch is in fact just an errata on the previous patch which added the write direction.
Thanks, patch committed to trunk.