summaryrefslogtreecommitdiff
path: root/cesar/ecos
diff options
context:
space:
mode:
authordufour2009-09-10 13:45:16 +0000
committerdufour2009-09-10 13:45:16 +0000
commitb1e0a6e26611ed660c0f0005bc8347b834fab90a (patch)
tree5a4c6a388ca16e11e1ed1818a0097afd80db2c0d /cesar/ecos
parentad7e1e565a929ffce0d2fe83fc6ab4bd06ce2d53 (diff)
* ecos
- workaround to correct the case where snprintf is called with a size of 0. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@5499 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/ecos')
-rw-r--r--cesar/ecos/packages/language/c/libc/stdio/current/src/common/vsnprintf.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/cesar/ecos/packages/language/c/libc/stdio/current/src/common/vsnprintf.cxx b/cesar/ecos/packages/language/c/libc/stdio/current/src/common/vsnprintf.cxx
index 34c75c9946..139e2a2689 100644
--- a/cesar/ecos/packages/language/c/libc/stdio/current/src/common/vsnprintf.cxx
+++ b/cesar/ecos/packages/language/c/libc/stdio/current/src/common/vsnprintf.cxx
@@ -105,6 +105,11 @@ externC int
vsnprintf( char *s, size_t size, const char *format, va_list arg ) __THROW
{
int rc;
+
+ // NSc: should not write if size is 0. Hack to work around eCos bug.
+ if (size == 0)
+ return 1234;
+
// construct a fake device with the address of the string we've
// been passed as its private data. This way we can use the data
// directly
@@ -122,9 +127,7 @@ vsnprintf( char *s, size_t size, const char *format, va_list arg ) __THROW
// Null-terminate it, but note that s has been changed by str_write(), so
// that it now points to the end of the string
- // NSc: should not write if size is 0.
- if (size != 0)
- s[0] = '\0';
+ s[0] = '\0';
return rc;