diff options
author | Matthias Aßhauer <mha1993@live.de> | 2024-04-03 15:42:02 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-04-03 14:54:28 -0700 |
commit | 2406bf5fc5fbaa042e05fc0001ba72beb888d60f (patch) | |
tree | 055d689b470c41a1f1631a35c1fb4c2428210a90 /git-compat-util.h | |
parent | c75fd8d8150afdf836b63a8e0534d9b9e3e111ba (diff) | |
download | git-2406bf5fc5fbaa042e05fc0001ba72beb888d60f.tar.gz |
Win32: detect unix socket support at runtime
Windows 10 build 17063 introduced support for unix sockets to Windows.
bb390b1 (git-compat-util: include declaration for unix sockets in
windows, 2021-09-14) introduced a way to build git with unix socket
support on Windows, but you still had to decide at build time which
Windows version the compiled executable was supposed to run on.
We can detect at runtime wether the operating system supports unix
sockets and act accordingly for all supported Windows versions.
This fixes https://github.com/git-for-windows/git/issues/3892
Signed-off-by: Matthias Aßhauer <mha1993@live.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-compat-util.h')
-rw-r--r-- | git-compat-util.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/git-compat-util.h b/git-compat-util.h index 7c2a6538e5..044f87454a 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -218,6 +218,18 @@ struct strbuf; #define GIT_WINDOWS_NATIVE #endif +#if defined(NO_UNIX_SOCKETS) || !defined(GIT_WINDOWS_NATIVE) +static inline int _have_unix_sockets(void) +{ +#if defined(NO_UNIX_SOCKETS) + return 0; +#else + return 1; +#endif +} +#define have_unix_sockets _have_unix_sockets +#endif + #include <unistd.h> #include <stdio.h> #include <sys/stat.h> |