mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-30 15:43:32 +01:00
Fix two compile-blockers in tor_vasprintf().
1) mingw doesn't have _vscprintf(); mingw instead has a working snprintf. 2) windows compilers that _do_ have a working _vscprintf spell it so; they do not spell it _vcsprintf().
This commit is contained in:
parent
84924fcd30
commit
af9dd4af02
3
changes/fix_vscprintf_compile
Normal file
3
changes/fix_vscprintf_compile
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
o Major bugfixes:
|
||||||
|
- Fix two typos in tor_vasprintf() that prevented compilation in
|
||||||
|
Windows.
|
@ -355,12 +355,12 @@ tor_vasprintf(char **strp, const char *fmt, va_list args)
|
|||||||
else
|
else
|
||||||
*strp = strp_tmp;
|
*strp = strp_tmp;
|
||||||
return r;
|
return r;
|
||||||
#elif defined(MS_WINDOWS)
|
#elif defined(_MSC_VER)
|
||||||
/* On Windows, _vsnprintf won't tell us the length of the string if it
|
/* On Windows, _vsnprintf won't tell us the length of the string if it
|
||||||
* overflows, so we need to use _vcsprintf to tell how much to allocate */
|
* overflows, so we need to use _vcsprintf to tell how much to allocate */
|
||||||
int len, r;
|
int len, r;
|
||||||
char *res;
|
char *res;
|
||||||
len = _vcsprintf(fmt, args);
|
len = _vscprintf(fmt, args);
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
*strp = NULL;
|
*strp = NULL;
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user