diff options
| author | Patrick Steinhardt <ps@pks.im> | 2025-04-15 11:38:16 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-04-15 08:24:35 -0700 |
| commit | 97dc141fd676e7079c2fd51e3bea2681a5b9f824 (patch) | |
| tree | fb8a738d18be7814be0ed6dc2ad07e4e84d3cbfc /git-compat-util.h | |
| parent | 1a99fe8010642a71063536510c578c1543d763b4 (diff) | |
| download | git-97dc141fd676e7079c2fd51e3bea2681a5b9f824.tar.gz | |
object-file: move `git_open_cloexec()` to "compat/open.c"
The `git_open_cloexec()` wrapper function provides the ability to open a
file with `O_CLOEXEC` in a platform-agnostic way. This function is
provided by "object-file.c" even though it is not specific to the object
subsystem at all.
Move the file into "compat/open.c". This file already exists before this
commit, but has only been compiled conditionally depending on whether or
not open(3p) may return EINTR. With this change we now unconditionally
compile the object, but wrap `git_open_with_retry()` in an ifdef.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-compat-util.h')
| -rw-r--r-- | git-compat-util.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/git-compat-util.h b/git-compat-util.h index cf733b38ac..9273a8ee08 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -1000,6 +1000,9 @@ int git_vsnprintf(char *str, size_t maxsize, int git_open_with_retry(const char *path, int flag, ...); #endif +int git_open_cloexec(const char *name, int flags); +#define git_open(name) git_open_cloexec(name, O_RDONLY) + #ifdef __GLIBC_PREREQ #if __GLIBC_PREREQ(2, 1) #define HAVE_STRCHRNUL |
