This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

1.7.5+: Bug in write() handling of 'disk full' condition? (XP)


Hi,

I'm running a Windows XP SP3 with NTFS drives and woefully little disk
space.. I have ~200MB free on my D:\ drive. When I use write() with a
buffer larger than my available disk space, the return value is bogus
and sometimes larger than the buffer size I pass in (!). errno is not
set. I believe this is due to incorrect STATUS_DISK_FULL handling in
winsup/cygwin/fhandler.cc:

  if (!NT_SUCCESS (status))
    {
      if (status == STATUS_DISK_FULL && io.Information > 0)
        goto written;
[...]
written:
  return io.Information;
}

io.Information is only filled in if status is STATUS_SUCCESS. Here is
what the Wine project has to say on the topic:
http://source.winehq.org/WineAPI/NtWriteFile.html

See also the small utility in attachment, which uses NtWriteFile
directly and dumps status and io.Information out to the screen. Here
is what it does on my system with 200 MB available:

$ ./testwrite.exe 256
writing 256 MB...
bytes: 10000000

status: c000007f (STATUS_DISK_FULL)
iosb.info: 6116ce83

iosb.info looks a lot like the garbage values write() was returning.

I would be happy to submit a patch but I just wanted to get discussion
started on this topic first, especially since changes in this area of
the code are potentially very far-reaching.

Catalin

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]