mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-04-19 21:02:17 +03:00
parent
151d4f8591
commit
07af42c052
@ -244,18 +244,6 @@ wsrep::reporter::write_file(double const tstamp)
|
|||||||
{ "DISCONNECTING", "Disconnecting", t_indefinite }
|
{ "DISCONNECTING", "Disconnecting", t_indefinite }
|
||||||
};
|
};
|
||||||
|
|
||||||
// prepare template for mkstemp()
|
|
||||||
file_name_.copy(template_, file_name_.length());
|
|
||||||
TEMP_EXTENSION.copy(template_ +file_name_.length(),TEMP_EXTENSION.length());
|
|
||||||
|
|
||||||
int const fd(mkstemp(template_));
|
|
||||||
if (fd < 0)
|
|
||||||
{
|
|
||||||
std::cerr << "Reporter could not open temporary file `" << template_
|
|
||||||
<< "': " << strerror(errno) << " (" << errno << ")\n";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
double const seconds(floor(tstamp));
|
double const seconds(floor(tstamp));
|
||||||
time_t const tt = time_t(seconds);
|
time_t const tt = time_t(seconds);
|
||||||
struct tm date;
|
struct tm date;
|
||||||
@ -283,8 +271,21 @@ wsrep::reporter::write_file(double const tstamp)
|
|||||||
os << "\t}\n";
|
os << "\t}\n";
|
||||||
os << "}\n";
|
os << "}\n";
|
||||||
|
|
||||||
std::string str(os.str());
|
std::string const str(os.str());
|
||||||
|
|
||||||
|
// prepare template for mkstemp()
|
||||||
|
file_name_.copy(template_, file_name_.length());
|
||||||
|
TEMP_EXTENSION.copy(template_ +file_name_.length(),TEMP_EXTENSION.length());
|
||||||
|
|
||||||
|
int const fd(mkstemp(template_));
|
||||||
|
if (fd < 0)
|
||||||
|
{
|
||||||
|
std::cerr << "Reporter could not open temporary file `" << template_
|
||||||
|
<< "': " << strerror(errno) << " (" << errno << ")\n";
|
||||||
|
return;
|
||||||
|
}
|
||||||
ssize_t err(write(fd, str.c_str(), str.length()));
|
ssize_t err(write(fd, str.c_str(), str.length()));
|
||||||
|
close(fd);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
{
|
{
|
||||||
std::cerr << "Could not write " << str.length()
|
std::cerr << "Could not write " << str.length()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user