[PATCH] mkdir: alway check-for-existence

Corinna Vinschen corinna-cygwin@cygwin.com
Mon Jun 3 19:35:00 GMT 2019


Hi Ben,

I'm fine with the patch, and it's short enough not to require an entry
in the CONTRIBUTORS file, but the commit msg needs some rephrasing:

On Jun  3 20:31, Ben wrote:
> When using either CreateDirectory or NtCreateFile when creating a directory
> that already exists, these functions return: ERROR_ALREADY_EXISTS

The Win32 and NT error codes don't match, so I'd prefer to drop
CreateDirectory from the text and use the NT status code names,
STATUS_OBJECT_NAME_COLLISION and STATUS_ACCESS_DENIED.

> However when using these function to create a directory (and all its
> parents)
> a normal use would be to start with mkdir(‘/c’) which translates to ‘C:\’

mkdir('/c') has no meaning by default.  The text should refer to the
default path "/cygdrive/c".

> for which both of these functions return ‘ERROR_ACCESS_DENIED’
> 
> We could call NtCreateFile with 'FILE_OPEN_IF' instead of 'FILE_CREATE' but
> since that's an internal function we better always check for existence
> ourselves.

Not sure what you're trying to say here.  In how far would using
FILE_OPEN_IF help?  AFAICS it would just erroneously return
STATUS_SUCCESS, so fhandler_disk_file::mkdir would have to check
io.Information for FILE_OPENED or something like that.  Maybe this
paragraph can just go away?


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20190603/c17de629/attachment.sig>


More information about the Cygwin-patches mailing list