Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
399ad08e
Commit
399ad08e
authored
Nov 11, 2004
by
tomas@poseidon.ndb.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
basestring_vsnprintf fix for size==0
parent
e0a3e48f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
6 deletions
+24
-6
ndb/src/common/util/basestring_vsnprintf.c
ndb/src/common/util/basestring_vsnprintf.c
+24
-6
No files found.
ndb/src/common/util/basestring_vsnprintf.c
View file @
399ad08e
...
...
@@ -20,6 +20,10 @@
#include <basestring_vsnprintf.h>
#include <my_config.h>
/*
#define SNPRINTF_RETURN_TRUNC
*/
int
basestring_snprintf
(
char
*
str
,
size_t
size
,
const
char
*
format
,
...)
{
...
...
@@ -47,13 +51,27 @@ static char basestring_vsnprintf_buf[16*1024];
int
basestring_vsnprintf
(
char
*
str
,
size_t
size
,
const
char
*
format
,
va_list
ap
)
{
int
ret
=
BASESTRING_VSNPRINTF_FUNC
(
str
,
size
,
format
,
ap
);
if
(
size
==
0
)
{
#ifdef SNPRINTF_RETURN_TRUNC
if
(
ret
==
size
-
1
||
ret
==
-
1
)
{
ret
=
BASESTRING_VSNPRINTF_FUNC
(
basestring_vsnprintf_buf
,
sizeof
(
basestring_vsnprintf_buf
),
format
,
ap
);
return
BASESTRING_VSNPRINTF_FUNC
(
basestring_vsnprintf_buf
,
sizeof
(
basestring_vsnprintf_buf
),
format
,
ap
);
#else
char
buf
[
1
];
return
BASESTRING_VSNPRINTF_FUNC
(
buf
,
1
,
format
,
ap
);
#endif
}
{
int
ret
=
BASESTRING_VSNPRINTF_FUNC
(
str
,
size
,
format
,
ap
);
#ifdef SNPRINTF_RETURN_TRUNC
if
(
ret
==
size
-
1
||
ret
==
-
1
)
{
ret
=
BASESTRING_VSNPRINTF_FUNC
(
basestring_vsnprintf_buf
,
sizeof
(
basestring_vsnprintf_buf
),
format
,
ap
);
}
#endif
return
ret
;
return
ret
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment