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:
authorJunio C Hamano <gitster@pobox.com>2022-04-12 02:44:45 +0300
committerJunio C Hamano <gitster@pobox.com>2022-04-12 02:44:45 +0300
commitf1b50ec6f85883c483b344442c69cd3d88b38380 (patch)
treefdada8c7b4cab8cb095c98e83cf22246a638d775 /git-compat-util.h
parentab1f2765f78e75ee51dface57e1071b3b7f42b09 (diff)
parent53ef17d3ee0f7fcb151f428ee3bd736b8046825f (diff)
Merge tag 'v2.35.2'
Diffstat (limited to 'git-compat-util.h')
-rw-r--r--git-compat-util.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/git-compat-util.h b/git-compat-util.h
index 68a9b9cd97..58fd813bd0 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -436,6 +436,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)
{