git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Martin Ågren" <martin.agren@gmail.com>
To: Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>,
	Johannes Schindelin <johannes.schindelin@gmx.de>,
	Nathan Sanders <spekbukkem@gmail.com>
Subject: Re: [PATCH] mingw: cope with the Isilon network file system
Date: Thu, 9 Apr 2020 12:57:03 +0200	[thread overview]
Message-ID: <CAN0heSrvZb3z3JdYSXs4Dy4nBwPYBAQZ5Zf2f9RSeUnyQSLeeg@mail.gmail.com> (raw)
In-Reply-To: <pull.756.git.git.1586427853403.gitgitgadget@gmail.com>

On Thu, 9 Apr 2020 at 12:26, Johannes Schindelin via GitGitGadget
<gitgitgadget@gmail.com> wrote:

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

(This code, which is being removed, used "," to avoid having to introduce
braces. There's another instance of this pattern a bit above.)

> +       if (handle == INVALID_HANDLE_VALUE) {

(Adding a brace here.)

> +               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 a unknow error. If

s/ a / an /
s/unknow/&n/

> +                * so, the error is now forced to be an ERROR_PATH_NOT_FOUND
> +                * error instead.
> +                */

"is now forced" sounds more like it describes this change/commit, rather
than this piece of code. Maybe this final sentence can be scrapped
entirely, since the forcing/translating/mapping is obvious from the code
anyway? The remainder of the comment goes into *why* and looks more
useful. Just my 2 cents.

> +               if (err == ERROR_INVALID_PARAMETER)
> +                       err = ERROR_PATH_NOT_FOUND;
> +               return errno = err_win_to_posix(err), -1;
> +       }

Now there's no need to avoid introducing braces, so maybe split this
into two lines for a lower huh-factor?

  errno = err_win_to_posix(err);
  return -1;

Martin

  reply	other threads:[~2020-04-09 10:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-09 10:24 [PATCH] mingw: cope with the Isilon network file system Johannes Schindelin via GitGitGadget
2020-04-09 10:57 ` Martin Ågren [this message]
2020-04-09 12:02   ` Johannes Schindelin
2020-04-10 11:28 ` [PATCH v2] " Johannes Schindelin via GitGitGadget
2020-04-10 20:21   ` Junio C Hamano

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=CAN0heSrvZb3z3JdYSXs4Dy4nBwPYBAQZ5Zf2f9RSeUnyQSLeeg@mail.gmail.com \
    --to=martin.agren@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=spekbukkem@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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).