git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "AreaZR via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: AreaZR <gfunni234@gmail.com>, Seija Kijin <doremylover123@gmail.com>
Subject: [PATCH v4] mingw: check that the file attributes are valid before modifying them
Date: Wed, 18 Dec 2024 00:37:08 +0000	[thread overview]
Message-ID: <pull.1413.v4.git.git.1734482229018.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1413.v3.git.git.1673189354738.gitgitgadget@gmail.com>

From: Seija Kijin <doremylover123@gmail.com>

If the attributes are invalid, return -1
to indicate an error.

Signed-off-by: Seija Kijin <doremylover123@gmail.com>
---
    mingw: check that the file attributes are valid before modifying them
    
    Thanks for taking the time to contribute to Git! Please be advised that
    the Git community does not use github.com for their contributions.
    Instead, we use a mailing list (git@vger.kernel.org) for code
    submissions, code reviews, and bug reports. Nevertheless, you can use
    GitGitGadget (https://gitgitgadget.github.io/) to conveniently send your
    Pull Requests commits to our mailing list.
    
    Please read the "guidelines for contributing" linked above!

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1413%2FAreaZR%2Fset-hidden-flag-v4
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1413/AreaZR/set-hidden-flag-v4
Pull-Request: https://github.com/git/git/pull/1413

Range-diff vs v3:

 1:  0cbe8bce617 = 1:  0fed7ade880 mingw: check that the file attributes are valid before modifying them


 compat/mingw.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/compat/mingw.c b/compat/mingw.c
index 63f36c893bf..7f52a4362fe 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -446,6 +446,11 @@ static inline int needs_hiding(const char *path)
 static int set_hidden_flag(const wchar_t *path, int set)
 {
 	DWORD original = GetFileAttributesW(path), modified;
+	if (original == INVALID_FILE_ATTRIBUTES) {
+		errno = err_win_to_posix(GetLastError());
+		return -1;
+	}
+
 	if (set)
 		modified = original | FILE_ATTRIBUTE_HIDDEN;
 	else

base-commit: 063bcebf0c917140ca0e705cbe0fdea127e90086
-- 
gitgitgadget

      reply	other threads:[~2024-12-18  0:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-22 20:22 [PATCH] mingw: check that the file attributes are valid Rose via GitGitGadget
2023-01-08 14:46 ` [PATCH v2] " Rose via GitGitGadget
2023-01-08 14:49   ` [PATCH v3] mingw: check that the file attributes are valid before modifying them Rose via GitGitGadget
2024-12-18  0:37     ` AreaZR via GitGitGadget [this message]

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=pull.1413.v4.git.git.1734482229018.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=doremylover123@gmail.com \
    --cc=gfunni234@gmail.com \
    --cc=git@vger.kernel.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 NNTP newsgroup(s).