From: "Rose via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Rose <83477269+AtariDreams@users.noreply.github.com>,
Seija Kijin <doremylover123@gmail.com>
Subject: [PATCH v3] mingw: check that the file attributes are valid before modifying them
Date: Sun, 08 Jan 2023 14:49:14 +0000 [thread overview]
Message-ID: <pull.1413.v3.git.git.1673189354738.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1413.v2.git.git.1673189172832.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
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1413%2FAtariDreams%2Fset-hidden-flag-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1413/AtariDreams/set-hidden-flag-v3
Pull-Request: https://github.com/git/git/pull/1413
Range-diff vs v2:
1: f1cc7d9a98b ! 1: 0cbe8bce617 mingw: check that the file attributes are valid
@@ Metadata
Author: Seija Kijin <doremylover123@gmail.com>
## Commit message ##
- mingw: check that the file attributes are valid
+ mingw: check that the file attributes are valid before modifying them
If the attributes are invalid, return -1
to indicate an error.
compat/mingw.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/compat/mingw.c b/compat/mingw.c
index af397e68a1d..01bafa01e92 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -435,6 +435,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: a38d39a4c50d1275833aba54c4dbdfce9e2e9ca1
--
gitgitgadget
next prev parent reply other threads:[~2023-01-08 14:49 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 ` Rose via GitGitGadget [this message]
2024-12-18 0:37 ` [PATCH v4] mingw: check that the file attributes are valid before modifying them AreaZR via GitGitGadget
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.v3.git.git.1673189354738.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=83477269+AtariDreams@users.noreply.github.com \
--cc=doremylover123@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.