Subject: Re: [PATCH] git-compat-util.h: Fix build without threads

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Sat, 26 Nov 2022 00:47:27 +0100

On Fri, Nov 25 2022, Bagas Sanjaya wrote:

> From: Fabrice Fontaine <[email-masked]>
>
> Git build with toolchains without threads support is broken (as reported
> by Buildroot autobuilder [1]) since version 2.29.0, which traces back to

> --- a/git-compat-util.h
> +++ b/git-compat-util.h
> @@ -1470,7 +1470,8 @@ int open_nofollow(const char *path, int flags);
>  # define SHELL_PATH "/bin/sh"
>  #endif
>  
> -#ifndef _POSIX_THREAD_SAFE_FUNCTIONS
> +
> +#if !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && defined(NO_FLOCKFILE)

Per f43cce23add (git-compat-util: add fallbacks for unlocked stdio,
2015-04-16) wouldn't it make more sense to do something like:

#ifdef NO_FLOCKFILE
#undef _POSIX_THREAD_SAFE_FUNCTIONS
#endif

Or the other way around here? I.e. have _POSIX_THREAD_SAFE_FUNCTIONS
define/undefine NO_FLOCKFILE?