From 18a4f6be6b4cfc34de6f80c36ab3ef951a0f7164 Mon Sep 17 00:00:00 2001 From: Duy Nguyen Date: Tue, 12 Feb 2019 21:14:41 +0700 Subject: git-compat-util: work around fileno(fp) that is a macro MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On various BSD's, fileno(fp) is implemented as a macro that directly accesses the fields in the FILE * object, which breaks a function that accepts a "void *fp" parameter and calls fileno(fp) and expect it to work. Work it around by adding a compile-time knob FILENO_IS_A_MACRO that inserts a real helper function in the middle of the callchain. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- compat/fileno.c | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 compat/fileno.c (limited to 'compat') diff --git a/compat/fileno.c b/compat/fileno.c new file mode 100644 index 0000000000..7b105f4cd7 --- /dev/null +++ b/compat/fileno.c @@ -0,0 +1,7 @@ +#define COMPAT_CODE +#include "../git-compat-util.h" + +int git_fileno(FILE *stream) +{ + return fileno(stream); +} -- cgit v1.3