The only thing which broke my old code regarding switching to vsnprintf
is that old Ns_DStringPrintf handled empty string differently, vsnprintf
now puts (null), before that empty string did not put anything.
I still need to review si the damage is critical enough or never upgrade
until all code updated. That sucks
Vlad Seryakov wrote:
> Yes, works fine now, Thanks
>
> Stephen Deasey wrote:
>> On 10/13/07, Vlad Seryakov <[EMAIL PROTECTED]> wrote:
>>> I was able to find the location which causes the crash but i am not sure
>>> how to fix it
>>>
>>> In function Ns_VALog i call vsnprintf directly, it works, when it is
>>> called via Ns_DStringVPintf it crashes. using va_copy does not help
>>>
>>
>> diff -r 22a912b584eb nsd/dstring.c
>> --- a/nsd/dstring.c Fri Oct 12 20:35:13 2007 +0100
>> +++ b/nsd/dstring.c Sat Oct 13 19:46:22 2007 +0100
>> @@ -176,10 +176,11 @@ Ns_DStringPrintf(Ns_DString *dsPtr, CONS
>> */
>>
>> char *
>> -Ns_DStringVPrintf(Ns_DString *dsPtr, CONST char *fmt, va_list ap)
>> -{
>> - char *buf;
>> - int origLength, newLength, bufLength, result;
>> +Ns_DStringVPrintf(Ns_DString *dsPtr, CONST char *fmt, va_list apSrc)
>> +{
>> + char *buf;
>> + int origLength, newLength, bufLength, result;
>> + va_list ap;
>>
>> origLength = dsPtr->length;
>>
>> @@ -205,11 +206,13 @@ Ns_DStringVPrintf(Ns_DString *dsPtr, CON
>> buf = dsPtr->string + origLength;
>> bufLength = newLength - origLength;
>>
>> + va_copy(ap, apSrc);
>> #ifdef __WIN32
>> result = _vsnprintf_s(buf, bufLength, fmt, ap);
>> #else
>> result = vsnprintf(buf, bufLength, fmt, ap);
>> #endif
>> + va_end(ap);
>>
>> /*
>> * Check for overflow and retry. For win32 just double the buffer size
>> @@ -229,11 +232,13 @@ Ns_DStringVPrintf(Ns_DString *dsPtr, CON
>> buf = dsPtr->string + origLength;
>> bufLength = newLength - origLength;
>>
>> + va_copy(ap, apSrc);
>> #ifdef __WIN32
>> result = _vsnprintf_s(buf, bufLength, fmt, ap);
>> #else
>> result = vsnprintf(buf, bufLength, fmt, ap);
>> #endif
>> + va_end(ap);
>> }
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by: Splunk Inc.
>> Still grepping through log files to find problems? Stop.
>> Now Search log events and configuration files using AJAX and a browser.
>> Download your FREE copy of Splunk now >> http://get.splunk.com/
>> _______________________________________________
>> naviserver-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/naviserver-devel
>>
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
naviserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/naviserver-devel