[phobos] phobos commit, revision 1560

Shin Fujishiro rsinfu at gmail.com
Thu May 27 21:51:44 PDT 2010


Adam Ruppe <destructionator at gmail.com> wrote:
> I remember seeing what looked like a bug in remove() when working on
> the Windows port of rdmd. I don't know if it is related to what you
> just changed.
> 
> I think I got the problem figured out, but I never committed a fix.
> 
> First, create a file and remove it. Should be no exception, worked
> last time I saw it.
> 
> Next, create a file, open it in another process (I used a directory
> and cmd.exe), then remove it. Now, this is where I saw it throw an
> exception saying "success". I figure the problem was that the Windows
> function returned something saying "file in use, but delete is queued
> up", which enforce saw as an error, but GetLastError called success.
> 
> Probably a different bug than what you looked at, but maybe not.
> 

Verified, it's the same bug.  A wrong error message was produced.

If one attempts to remove opened file, DeleteFile fails and sets win32
error code ERROR_SHARING_VIOLATION (32).  But cenforce used errno
(instead of GetLastError) for producing win32 error message.  errno was
zero, so the "success" error message was produced*.

* zero == win32 error code ERROR_SUCCESS

Shin


More information about the phobos mailing list