From 6a65b4c30532bed25335a75d30345bfcccb4725e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 17 Oct 2020 13:40:18 +0200 Subject: [PATCH] lib/nfs/patches: disable the snprintf->sprintf_s alias snprintf() is available on mingw, and the libnfs kludge broke the build with mingw, because sprintf_s() was now both an inline function and a "dllimport" function (because the macro renamed the inline function snprintf() to sprintf_s() in mingw's stdio.h). --- python/build/libs.py | 1 + src/lib/nfs/patches/no_sprintf_s | 14 ++++++++++++++ src/lib/nfs/patches/series | 1 + 3 files changed, 16 insertions(+) create mode 100644 src/lib/nfs/patches/no_sprintf_s create mode 100644 src/lib/nfs/patches/series diff --git a/python/build/libs.py b/python/build/libs.py index 7584caa16..c9cfd1d25 100644 --- a/python/build/libs.py +++ b/python/build/libs.py @@ -429,6 +429,7 @@ libnfs = AutotoolsProject( '--disable-utils', '--disable-examples', ], base='libnfs-libnfs-4.0.0', + patches='src/lib/nfs/patches', autoreconf=True, ) diff --git a/src/lib/nfs/patches/no_sprintf_s b/src/lib/nfs/patches/no_sprintf_s new file mode 100644 index 000000000..c2bce1466 --- /dev/null +++ b/src/lib/nfs/patches/no_sprintf_s @@ -0,0 +1,14 @@ +Index: libnfs-libnfs-4.0.0/include/win32/win32_compat.h +=================================================================== +--- libnfs-libnfs-4.0.0.orig/include/win32/win32_compat.h ++++ libnfs-libnfs-4.0.0/include/win32/win32_compat.h +@@ -133,7 +133,9 @@ struct pollfd { + + /* Wrapper macros to call misc. functions win32 is missing */ + #define poll(x, y, z) win32_poll(x, y, z) ++#ifndef __MINGW32__ + #define snprintf sprintf_s ++#endif + #define inet_pton(x,y,z) win32_inet_pton(x,y,z) + #define open(x, y, z) _open(x, y, z) + #ifndef lseek diff --git a/src/lib/nfs/patches/series b/src/lib/nfs/patches/series new file mode 100644 index 000000000..d2e2667c9 --- /dev/null +++ b/src/lib/nfs/patches/series @@ -0,0 +1 @@ +no_sprintf_s