summaryrefslogtreecommitdiff
path: root/indra/llxml/llxmlnode.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llxml/llxmlnode.cpp')
-rw-r--r--indra/llxml/llxmlnode.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/indra/llxml/llxmlnode.cpp b/indra/llxml/llxmlnode.cpp
index 29e7214020..de4c7981e8 100644
--- a/indra/llxml/llxmlnode.cpp
+++ b/indra/llxml/llxmlnode.cpp
@@ -560,11 +560,11 @@ bool LLXMLNode::parseFile(
fseek(fp, 0, SEEK_SET);
U8* buffer = new U8[length+1];
- fread(buffer, 1, length, fp);
- buffer[length] = 0;
+ size_t nread = fread(buffer, 1, length, fp);
+ buffer[nread] = 0;
fclose(fp);
- bool rv = parseBuffer(buffer, length, node, defaults_tree);
+ bool rv = parseBuffer(buffer, nread, node, defaults_tree);
delete [] buffer;
return rv;
}
@@ -734,7 +734,10 @@ void LLXMLNode::writeToFile(FILE *fOut, LLString indent)
std::ostringstream ostream;
writeToOstream(ostream, indent);
LLString outstring = ostream.str();
- fwrite(outstring.c_str(), 1, outstring.length(), fOut);
+ if (fwrite(outstring.c_str(), 1, outstring.length(), fOut) != outstring.length())
+ {
+ llwarns << "Short write" << llendl;
+ }
}
void LLXMLNode::writeToOstream(std::ostream& output_stream, const LLString& indent)