public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: errno: handle ERROR_CASE_DIFFERING_NAMES_IN_DIR
Date: Thu,  2 Dec 2021 16:30:59 +0000 (GMT)	[thread overview]
Message-ID: <20211202163059.B7B4E385BF9C@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=fb1fe932038e5a9833fcc5fc53365a2212d76584

commit fb1fe932038e5a9833fcc5fc53365a2212d76584
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Thu Dec 2 14:13:43 2021 +0100

    Cygwin: errno: handle ERROR_CASE_DIFFERING_NAMES_IN_DIR
    
    Rather than special case status code 0xc00004b3, add status and matching
    error code to ntdll.h and handle it as part of the standard error mapping.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/errno.cc              |  1 +
 winsup/cygwin/fhandler_disk_file.cc | 10 +---------
 winsup/cygwin/ntdll.h               |  5 +++++
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/winsup/cygwin/errno.cc b/winsup/cygwin/errno.cc
index 420326566..55219cccc 100644
--- a/winsup/cygwin/errno.cc
+++ b/winsup/cygwin/errno.cc
@@ -53,6 +53,7 @@ static const errmap_t errmap[] =
   X (CALL_NOT_IMPLEMENTED,	ENOSYS),
   X (CANCELLED,			EINTR),
   X (CANNOT_MAKE,		EPERM),
+  X (CASE_DIFFERING_NAMES_IN_DIR, EINVAL),
   X (CHILD_NOT_COMPLETE,	EBUSY),
   X (COMMITMENT_LIMIT,		EAGAIN),
   X (CONNECTION_REFUSED,	ECONNREFUSED),
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index 26726c5d7..3cec1ed84 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -2547,15 +2547,7 @@ fhandler_disk_file::fs_ioc_setflags (uint64_t flags)
 					 FileCaseSensitiveInformation);
 	  if (!NT_SUCCESS (status))
 	    {
-	      /* Special case: The directory contains files which only
-		 differ in case.  NtSetInformationFile refuses to change
-		 back to case insensitivity and returns status 0xc00004b3.
-		 There's no STATUS_xyz macro assigned to that value yet,
-		 nor does it map to a useful Win32 error value. */
-	      if (status == (NTSTATUS) 0xc00004b3)
-		set_errno (EINVAL);	/* Does that make sense? */
-	      else
-		__seterrno_from_nt_status (status);
+	      __seterrno_from_nt_status (status);
 	      goto out;
 	    }
 	}
diff --git a/winsup/cygwin/ntdll.h b/winsup/cygwin/ntdll.h
index f7c427e40..59c396676 100644
--- a/winsup/cygwin/ntdll.h
+++ b/winsup/cygwin/ntdll.h
@@ -15,6 +15,11 @@
 extern GUID __cygwin_socket_guid;
 #define CYGWIN_SOCKET_GUID (&__cygwin_socket_guid)
 
+/* Status codes not known to Mingw-w64 yet.  The error code needs to
+   be maintained here as well as long as Mingw-w64 didn't follow up. */
+#define STATUS_CASE_DIFFERING_NAMES_IN_DIR	((NTSTATUS)0xC00004B3)
+#define ERROR_CASE_DIFFERING_NAMES_IN_DIR	__MSABI_LONG(424)
+
 /* Custom Cygwin-only status codes. */
 #define STATUS_THREAD_SIGNALED	((NTSTATUS)0xe0000001)
 #define STATUS_THREAD_CANCELED	((NTSTATUS)0xe0000002)


                 reply	other threads:[~2021-12-02 16:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211202163059.B7B4E385BF9C@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).