[freetds] [ freetds-Patches-1848920 ] Patch for vsnprintf bug when compiling with VC++ .NET 2003

SourceForge.net noreply at sourceforge.net
Fri Dec 21 04:08:10 EST 2007


Patches item #1848920, was opened at 2007-12-11 22:27
Message generated for change (Comment added) made by freddy77
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=407808&aid=1848920&group_id=33106

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
>Category: None
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 5
Private: No
Submitted By: billmon (billmon)
Assigned to: Nobody/Anonymous (nobody)
Summary: Patch for vsnprintf bug when compiling with VC++ .NET 2003

Initial Comment:
When compiling replacements/vasprintf.c using Microsoft Visual C++ .NET 2003 compiler and the .NET 2003 SDK, vsnprintf is defined as _vsnprintf which causes autoconf to fail to find vsnprintf causing HAVE_VSNPRINTF to NOT be defined and the #else block in vasprintf to be compiled.  In this case, the NULL device was improperly defined as /dev/null on windows and should instead be \Device\Null which causes vasprintf to fail entirely and other calling functions (e.g. tds_submit_query) to also fail (the attached patch includes this change). 

In order to use the MS _vsnprintf function, the configure.in file should be augmented to include _vsnprintf in the AC_CHECK_FUNCS call that starts with vsnprintf and the file include/config.h.in should include the following 2 lines in the vicinity of the one that starts #undef HAVE_VSNPRINTF (the patch below does NOT include these 2 changes):

/* Define to 1 if you have the `_vsnprintf' function. */
#undef HAVE__VSNPRINTF

Finally, the declaration of the vsnprintf function in include/replacements.h should occur in the "#else" block of the following pre-compiler logic to redirect vsnprintf calls to MS's _vsnprintf (this is included in the path):

#if HAVE_UNDERVSNPRINTF
#define vsnprintf _vsnprintf
#define HAVE_VSNPRINTF 1
#else
   <vsnprintf decl goes here>
#endif

----------------------------------------------------------------------

>Comment By: Frediano Ziglio (freddy77)
Date: 2007-12-21 10:08

Message:
Logged In: YES 
user_id=75766
Originator: NO

Applied modified patch

freddy77


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=407808&aid=1848920&group_id=33106



More information about the FreeTDS mailing list