Cygwin 1.7.0 will change the size of MAX_PATH in its headers, but the old cygwin_conv_to_* API silently suffers from buffer overrun if more than 256 bytes occur in the conversion. As a result, cygwin developers wisely deprecated the old API when adding the new cygwin_path_conv, and compilation now issues a warning (which in turn cripples -Werror builds):
libltdl/loaders/loadlibrary.c: In function `vm_open': libltdl/loaders/loadlibrary.c:147: warning: `cygwin_conv_to_full_win32_path' is deprecated (declared at /usr/include/sys/cygwin.h:52) make[2]: *** [libltdl/loaders/loadlibrary.lo] Error 1 OK to apply? >From 2db764974e01cc576dd1bcfb7afad2ec7d64217a Mon Sep 17 00:00:00 2001 From: Eric Blake <[EMAIL PROTECTED]> Date: Wed, 30 Apr 2008 10:49:45 -0600 Subject: [PATCH] Support cygwin 1.7.0 in loadlibrary loader. * libltdl/m4/ltdl.m4 (LT_LIB_DLLOAD) <cygwin>: Check for modern function. * libltdl/loaders/loadlibrary.c (vm_open): Avoid deprecated cygwin_conv_to_full_win32_path. Signed-off-by: Eric Blake <[EMAIL PROTECTED]> --- ChangeLog | 8 ++++++++ libltdl/loaders/loadlibrary.c | 9 ++++++++- libltdl/m4/ltdl.m4 | 3 ++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ca8c2a1..b3c0616 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-04-30 Eric Blake <[EMAIL PROTECTED]> + + Support cygwin 1.7.0 in loadlibrary loader. + * libltdl/m4/ltdl.m4 (LT_LIB_DLLOAD) <cygwin>: Check for modern + function. + * libltdl/loaders/loadlibrary.c (vm_open): Avoid deprecated + cygwin_conv_to_full_win32_path. + 2008-04-29 Gary V. Vaughan <[EMAIL PROTECTED]> New libtoolize --no-warn option and LIBTOOLIZE_OPTIONS parsing. diff --git a/libltdl/loaders/loadlibrary.c b/libltdl/loaders/loadlibrary.c index 609870c..6558d43 100644 --- a/libltdl/loaders/loadlibrary.c +++ b/libltdl/loaders/loadlibrary.c @@ -136,7 +136,14 @@ vm_open (lt_user_data LT__UNUSED loader_data, const char *filename, return 0; } -#if defined(__CYGWIN__) +#if HAVE_DECL_CYGWIN_CONV_PATH + if (cygwin_conv_path (CCP_POSIX_TO_WIN_A, filename, wpath, MAX_PATH)) + { + LT__SETERROR (CANNOT_OPEN); + return 0; + } + len = 0; +#elif defined(__CYGWIN__) cygwin_conv_to_full_win32_path (filename, wpath); len = 0; #else diff --git a/libltdl/m4/ltdl.m4 b/libltdl/m4/ltdl.m4 index f6b1064..ed71570 100644 --- a/libltdl/m4/ltdl.m4 +++ b/libltdl/m4/ltdl.m4 @@ -711,6 +711,7 @@ beos*) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}load_add_on.la" ;; cygwin* | mingw* | os2* | pw32*) + AC_CHECK_DECLS([cygwin_conv_path], [], [], [[#include <sys/cygwin.h>]]) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}loadlibrary.la" ;; esac -- 1.5.5.1