After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 57690 - is_readable and is_writeable flags not set when creating iochannels under win32
is_readable and is_writeable flags not set when creating iochannels under win32
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: win32
1.3.x
Other Linux
: Normal major
: ---
Assigned To: Tor Lillqvist
Tor Lillqvist
Depends on:
Blocks:
 
 
Reported: 2001-07-17 21:55 UTC by Ron Steinke
Modified: 2011-02-18 15:55 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Ron Steinke 2001-07-17 21:55:25 UTC
The flags is_readable and is_writeable are not set when creating
a new GIOChannel under win32. This breaks most of the
new GIOChannel API, but does not cause a problem with the
old API.
Comment 1 Hans Breuer 2001-08-04 13:25:24 UTC
At 09:39 23.07.01 -0700, Ron Steinke wrote:
>Hans,
>	Looking at you implementation of g_io_channel_win32_new_fd(),
>you use fstat() to determine whether to set is_readable and 
is_writeable.
>Under UNIX, fstat() just returns file permissions, 
Maybe the same for win32 ...

>and you need to
>use fcntl() to determine whether the file was opened for reading,
>writing, or both. Is the same true for win32?
>
... but there is no fcntl() in the msvc runtime and I even can't find 
a
respective function in the Win32 Api. So relying on correcly set flags
may introduce a serious portability issue.

Anyone proofing that my interpretation is wrong is welcome,

	Hans 
Comment 2 Tor Lillqvist 2001-11-04 22:37:58 UTC
One possibility might be to try to read/write zero bytes. Maybe (and 
that is a big maybe) Win32 returns success if the file handle is 
readable/writeable? DOes a zero byte read from a pipe hang? There 
presumably are also 9x/NT/2k differences...
Comment 3 Owen Taylor 2002-03-07 19:27:02 UTC
Moving open 2.0.0 Win32 bugs to 2.0.1 milestone.
Comment 4 Owen Taylor 2002-03-25 22:24:32 UTC
Moving 2.0.1 Win32 bugs to 2.0.2 milestone.
Comment 5 Tor Lillqvist 2002-12-17 03:09:48 UTC
At least read() and write() in the Microsoft C library return right 
away if reading/writing zero bytes. But will have to check what the 
Win32 ReadFile() and WriteFile() do.
Comment 6 Tor Lillqvist 2002-12-17 03:59:19 UTC
Yup, ReadFile() and WriteFile() of zero bytes can be used to check if 
a file HANDLE is readable/writeable. At least for disk files. For 
pipes, PeekNamedPipe() can be used to check for readability. For 
console devices, ReadFile() even of zero bytes seems to block.
Comment 7 Tor Lillqvist 2002-12-17 04:54:26 UTC
Fix applied to HEAD. Reopen if there still are problems.