Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2022-03-17 12:57:31 +0300
committerJohannes Schindelin <johannes.schindelin@gmx.de>2022-03-24 02:24:29 +0300
commit6a2381a3e5176b8deb69c799ed2b600366d36d39 (patch)
tree9078babba9f51e3de0818cba5989c36cdff691d8 /git-compat-util.h
parent48bf2fa8bad054d66bd79c6ba903c89c704201f7 (diff)
parentcb95038137e9e66fc6a6b4a0e8db62bcc521b709 (diff)
Sync with 2.30.3
* maint-2.30: Git 2.30.3 setup_git_directory(): add an owner check for the top-level directory Add a function to determine whether a path is owned by the current user
Diffstat (limited to 'git-compat-util.h')
-rw-r--r--git-compat-util.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/git-compat-util.h b/git-compat-util.h
index dcc786edaa..261516231e 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -127,7 +127,9 @@
/* Approximation of the length of the decimal representation of this type. */
#define decimal_length(x) ((int)(sizeof(x) * 2.56 + 0.5) + 1)
-#if defined(__sun__)
+#ifdef __MINGW64__
+#define _POSIX_C_SOURCE 1
+#elif defined(__sun__)
/*
* On Solaris, when _XOPEN_EXTENDED is set, its header file
* forces the programs to be XPG4v2, defeating any _XOPEN_SOURCE
@@ -390,6 +392,18 @@ static inline int git_offset_1st_component(const char *path)
#define is_valid_path(path) 1
#endif
+#ifndef is_path_owned_by_current_user
+static inline int is_path_owned_by_current_uid(const char *path)
+{
+ struct stat st;
+ if (lstat(path, &st))
+ return 0;
+ return st.st_uid == geteuid();
+}
+
+#define is_path_owned_by_current_user is_path_owned_by_current_uid
+#endif
+
#ifndef find_last_dir_sep
static inline char *git_find_last_dir_sep(const char *path)
{