| Bug #55964 | Small race condition in output log writing | ||
|---|---|---|---|
| Submitted: | 13 Aug 2010 6:50 | Modified: | 13 Aug 2010 7:30 |
| Reporter: | Hartmut Holzgraefe | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Cluster: Cluster (NDB) storage engine | Severity: | S3 (Non-critical) |
| Version: | mysql-5.1-telco-6.3 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | ALL, mysql-cluster-7.1 | ||
[13 Aug 2010 6:50]
Hartmut Holzgraefe
[13 Aug 2010 7:30]
Hartmut Holzgraefe
proposed patch
Attachment: bug55964.patch (text/x-patch), 927 bytes.
[13 Aug 2010 7:30]
Hartmut Holzgraefe
=== modified file 'storage/ndb/src/common/util/NdbOut.cpp'
--- storage/ndb/src/common/util/NdbOut.cpp 2010-01-18 19:20:01 +0000
+++ storage/ndb/src/common/util/NdbOut.cpp 2010-08-13 07:26:45 +0000
@@ -128,9 +128,13 @@
char buf[1000];
va_start(ap, fmt);
- if (fmt != 0)
- BaseString::vsnprintf(buf, sizeof(buf)-1, fmt, ap);
- *this << buf << endl;
+ *buf = '\0';
+ if (fmt != 0) {
+ int len = BaseString::vsnprintf(buf, sizeof(buf)-1, fmt, ap);
+ buf[len] = '\n';
+ buf[len+1] = '\0';
+ }
+ *this << buf;
va_end(ap);
}
@@ -138,12 +142,15 @@
void
vndbout_c(const char * fmt, va_list ap){
char buf[1000];
-
+
+ *buf = '\0';
if (fmt != 0)
{
- BaseString::vsnprintf(buf, sizeof(buf)-1, fmt, ap);
+ int len = BaseString::vsnprintf(buf, sizeof(buf)-1, fmt, ap);
+ buf[len] = '\n';
+ buf[len+1] = '\0';
}
- ndbout << buf << endl;
+ ndbout << buf;
}
extern "C"
