On Thu, May 25, 2017 at 8:35 PM, Junio C Hamano <gits...@pobox.com> wrote:
> 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

errno to EINVAL (as of now it sounds as if it is a EINVAL = errno,
which makes no sense to me)

> 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,

cc'd people knowledgeable of Windows.

> 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 <gits...@pobox.com>
> ---
>  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
>

Reply via email to