[PATCH v3 13/13] is_missing_file_error(): work around EINVAL on Windows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When asked to open/fopen a path, e.g. "a/b:/c", which does not exist
on the filesystem, Windows (correctly) fails to open it but sets
EINVAL to errno because the pathname has characters that cannot be
stored in its filesystem.

As this is an expected failure, teach is_missing_file_error() helper
about this case.

This is RFC, as there may be a case where we get EINVAL from
open/fopen for reasons other than "the filesystem does not like this
pathname" that may be worth reporting to the user, and this change
is sweeping such an error under the rug.

Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx>
---
 wrapper.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/wrapper.c b/wrapper.c
index f1c87ec7ea..74aa3b7803 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -434,6 +434,10 @@ static void warn_on_inaccessible(const char *path)
  * see if the errno indicates a missing file that we can safely ignore.
  */
 static int is_missing_file_error(int errno_) {
+#ifdef GIT_WINDOWS_NATIVE
+	if (errno_ == EINVAL)
+		return 1;
+#endif
 	return (errno_ == ENOENT || errno_ == ENOTDIR);
 }
 
-- 
2.13.0-491-g71cfeddc25




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]