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]

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


On Jul 22 17:42, Catalin Patulea wrote:
> 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;
> }

I just examined the mailing list archives.  The code to handle
ERROR_DISK_FULL specially is > 11 years old.  Originally, if this error
occured, the function always returned with success.  My patch in 1999 to
return the written bytes only if they are > 0 was not overly helpful
either, apparently, nor was the translation into native NT literally.

I have no idea why this erroneous special handling of ERROR_DISK_FULL
has been added in the first place.

I *assume* there was some really good reason, but, hey, who on earth
needs *comments* in the code to explain what this code was supposed
to fix.  Not even the mailing list archives contain a hint.  Maybe
that was working around some Windows 9x bug, but since we're NT-only
now, I don't see a reason to keep this code in.

I applied a patch which simply removes the STATUS_DISK_FULL handling.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
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]