mirror of https://github.com/aria2/aria2
2009-07-22 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Make sure that stream is closed before renaming file. Unit test fails on mingw32 in the previous implementation. * src/CookieStorage.ccpull/1/head
parent
1731db1c60
commit
0d1d88257c
|
@ -1,3 +1,9 @@
|
||||||
|
2009-07-22 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
Make sure that stream is closed before renaming file. Unit test
|
||||||
|
fails on mingw32 in the previous implementation.
|
||||||
|
* src/CookieStorage.cc
|
||||||
|
|
||||||
2009-07-22 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2009-07-22 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Fixed the unit test error without sqlite3
|
Fixed the unit test error without sqlite3
|
||||||
|
|
|
@ -174,6 +174,7 @@ bool CookieStorage::load(const std::string& filename)
|
||||||
bool CookieStorage::saveNsFormat(const std::string& filename)
|
bool CookieStorage::saveNsFormat(const std::string& filename)
|
||||||
{
|
{
|
||||||
std::string tempfilename = filename+"__temp";
|
std::string tempfilename = filename+"__temp";
|
||||||
|
{
|
||||||
std::ofstream o(tempfilename.c_str(), std::ios::binary);
|
std::ofstream o(tempfilename.c_str(), std::ios::binary);
|
||||||
if(!o) {
|
if(!o) {
|
||||||
_logger->error("Cannot create cookie file %s, cause %s",
|
_logger->error("Cannot create cookie file %s, cause %s",
|
||||||
|
@ -184,7 +185,15 @@ bool CookieStorage::saveNsFormat(const std::string& filename)
|
||||||
i != _cookies.end(); ++i) {
|
i != _cookies.end(); ++i) {
|
||||||
o << (*i).toNsCookieFormat() << "\n";
|
o << (*i).toNsCookieFormat() << "\n";
|
||||||
if(!o) {
|
if(!o) {
|
||||||
_logger->error("Failed to save cookies to %s", filename.c_str());
|
_logger->error("Failed to save cookies to %s, cause %s",
|
||||||
|
filename.c_str(), strerror(errno));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
o.flush();
|
||||||
|
if(!o) {
|
||||||
|
_logger->error("Failed to save cookies to %s, cause %s",
|
||||||
|
filename.c_str(), strerror(errno));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue