]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'js/mingw-isilon-nfs'
authorJunio C Hamano <gitster@pobox.com>
Wed, 22 Apr 2020 20:42:58 +0000 (13:42 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 22 Apr 2020 20:42:58 +0000 (13:42 -0700)
* js/mingw-isilon-nfs:
  mingw: cope with the Isilon network file system

compat/mingw.c

index 178a70df61fd2417de7fc0aeb4b8019f27b9536f..8ee0b6408e945b369b30d9052c91aa7e1f31553a 100644 (file)
@@ -460,8 +460,21 @@ static int mingw_open_append(wchar_t const *wfilename, int oflags, ...)
        handle = CreateFileW(wfilename, FILE_APPEND_DATA,
                        FILE_SHARE_WRITE | FILE_SHARE_READ,
                        NULL, create, FILE_ATTRIBUTE_NORMAL, NULL);
-       if (handle == INVALID_HANDLE_VALUE)
-               return errno = err_win_to_posix(GetLastError()), -1;
+       if (handle == INVALID_HANDLE_VALUE) {
+               DWORD err = GetLastError();
+
+               /*
+                * Some network storage solutions (e.g. Isilon) might return
+                * ERROR_INVALID_PARAMETER instead of expected error
+                * ERROR_PATH_NOT_FOUND, which results in an unknown error. If
+                * so, let's turn the error to ERROR_PATH_NOT_FOUND instead.
+                */
+               if (err == ERROR_INVALID_PARAMETER)
+                       err = ERROR_PATH_NOT_FOUND;
+
+               errno = err_win_to_posix(err);
+               return -1;
+       }
 
        /*
         * No O_APPEND here, because the CRT uses it only to reset the