git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] mingw: check that the file attributes are valid
@ 2022-12-22 20:22 Rose via GitGitGadget
  2023-01-08 14:46 ` [PATCH v2] " Rose via GitGitGadget
  0 siblings, 1 reply; 3+ messages in thread
From: Rose via GitGitGadget @ 2022-12-22 20:22 UTC (permalink / raw)
  To: git; +Cc: Rose, Seija Kijin

From: Seija Kijin <doremylover123@gmail.com>

If the attributes are invalid, return an error.

Signed-off-by: Seija Kijin <doremylover123@gmail.com>
---
    mingw: check that the file attributes are valid

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

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

diff --git a/compat/mingw.c b/compat/mingw.c
index d614f156df1..71a039cdd7c 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: 7c2ef319c52c4997256f5807564523dfd4acdfc7
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2] mingw: check that the file attributes are valid
  2022-12-22 20:22 [PATCH] mingw: check that the file attributes are valid Rose via GitGitGadget
@ 2023-01-08 14:46 ` Rose via GitGitGadget
  2023-01-08 14:49   ` [PATCH v3] mingw: check that the file attributes are valid before modifying them Rose via GitGitGadget
  0 siblings, 1 reply; 3+ messages in thread
From: Rose via GitGitGadget @ 2023-01-08 14:46 UTC (permalink / raw)
  To: git; +Cc: Rose, Seija Kijin

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

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

Range-diff vs v1:

 1:  d2992745f3f ! 1:  f1cc7d9a98b mingw: check that the file attributes are valid
     @@ Metadata
       ## Commit message ##
          mingw: check that the file attributes are valid
      
     -    If the attributes are invalid, return an error.
     +    If the attributes are invalid, return -1
     +    to indicate an error.
      
          Signed-off-by: Seija Kijin <doremylover123@gmail.com>
      


 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v3] mingw: check that the file attributes are valid before modifying them
  2023-01-08 14:46 ` [PATCH v2] " Rose via GitGitGadget
@ 2023-01-08 14:49   ` Rose via GitGitGadget
  0 siblings, 0 replies; 3+ messages in thread
From: Rose via GitGitGadget @ 2023-01-08 14:49 UTC (permalink / raw)
  To: git; +Cc: Rose, Seija Kijin

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-08 14:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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

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