summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelliott_c <ocielliottc@users.noreply.github.com>2007-03-19 18:39:37 +0000
committerelliott_c <ocielliottc@users.noreply.github.com>2007-03-19 18:39:37 +0000
commitf682433b4a24e845468c3ba3be7b21fb12a5663a (patch)
tree4d19db522518e1d26a3cfd2a491ebedce54866b8
parent2d9fe212098b71dafc21dac2fe2d4aaf63ccbf14 (diff)
downloadATCD-f682433b4a24e845468c3ba3be7b21fb12a5663a.tar.gz
ChangeLogTag: Mon Mar 19 19:34:48 UTC 2007 Chad Elliott <elliott_c@ociweb.com>
-rw-r--r--TAO/ChangeLog16
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Flat_File_Persistence.cpp4
2 files changed, 19 insertions, 1 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 60c3f84facd..26f41dae913 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,19 @@
+Mon Mar 19 19:34:48 UTC 2007 Chad Elliott <elliott_c@ociweb.com>
+
+ * orbsvcs/orbsvcs/Naming/Flat_File_Persistence.cpp:
+
+ The code to set the null terminator on the "kind" read from
+ the persistence file was purposely removed. However, the original
+ reason that it was there was that this string was the only string
+ that was often of length zero. When fgets read nothing into the
+ string, it was then null terminated which yielded a string of zero
+ length. Without it, the string was filled with garbage.
+
+ The correct modification was to initialize the string passed to
+ fgets to an empty string and then call fgets. This handles cases
+ where nothing is read from the file. I have made this change in
+ each place where fgets is called.
+
Mon Mar 19 19:24:37 UTC 2007 Chad Elliott <elliott_c@ociweb.com>
* NEWS:
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Flat_File_Persistence.cpp b/TAO/orbsvcs/orbsvcs/Naming/Flat_File_Persistence.cpp
index 14a0b230c3e..efaa900e534 100644
--- a/TAO/orbsvcs/orbsvcs/Naming/Flat_File_Persistence.cpp
+++ b/TAO/orbsvcs/orbsvcs/Naming/Flat_File_Persistence.cpp
@@ -259,6 +259,7 @@ TAO_NS_FlatFileStream::operator >>(TAO_NS_Persistence_Record &record)
}
{
ACE_Auto_Basic_Array_Ptr<char> the_id (new char[bufSize + 1]);
+ the_id[0] = '\0';
if (ACE_OS::fgets (ACE_TEXT_CHAR_TO_TCHAR (the_id.get ()),
bufSize + 1,
fl_) == 0
@@ -290,6 +291,7 @@ TAO_NS_FlatFileStream::operator >>(TAO_NS_Persistence_Record &record)
{
ACE_Auto_Basic_Array_Ptr<char> the_kind (new char[bufSize + 1]);
+ the_kind[0] = '\0';
if (ACE_OS::fgets (ACE_TEXT_CHAR_TO_TCHAR (the_kind.get ()),
bufSize + 1,
fl_) == 0
@@ -298,7 +300,6 @@ TAO_NS_FlatFileStream::operator >>(TAO_NS_Persistence_Record &record)
this->setstate (badbit);
return *this;
}
- the_kind[bufSize] = '\0';
record.kind (ACE_CString (the_kind.get (), 0, false));
}
@@ -322,6 +323,7 @@ TAO_NS_FlatFileStream::operator >>(TAO_NS_Persistence_Record &record)
{
ACE_Auto_Basic_Array_Ptr<char> the_ref (new char[bufSize + 1]);
+ the_ref[0] = '\0';
if (ACE_OS::fgets (ACE_TEXT_CHAR_TO_TCHAR (the_ref.get ()),
bufSize + 1,
fl_) == 0