This is the mail archive of the
mailing list for the Cygwin project.
Re: 1.7.5+: Bug in write() handling of 'disk full' condition? (XP)
- From: Corinna Vinschen <corinna-cygwin at cygwin dot com>
- To: cygwin at cygwin dot com
- Date: Fri, 23 Jul 2010 12:08:39 +0200
- Subject: Re: 1.7.5+: Bug in write() handling of 'disk full' condition? (XP)
- References: <AANLkTinoCTcs_bndrSDZ-ixE1PTCIp6_lwA5mvI7k1Be@mail.gmail.com>
- Reply-to: cygwin at cygwin dot com
On Jul 22 17:42, Catalin Patulea wrote:
> 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
> if (!NT_SUCCESS (status))
> if (status == STATUS_DISK_FULL && io.Information > 0)
> goto 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.
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple