Replaced all instances of localtime with localtime_r
This commit is contained in:
parent
b6f0b596b2
commit
8c2360fd56
3 changed files with 6 additions and 3 deletions
|
@ -310,9 +310,10 @@ namespace Util{
|
||||||
}
|
}
|
||||||
time_t rawtime;
|
time_t rawtime;
|
||||||
struct tm *timeinfo;
|
struct tm *timeinfo;
|
||||||
|
struct tm timetmp;
|
||||||
char buffer[100];
|
char buffer[100];
|
||||||
time(&rawtime);
|
time(&rawtime);
|
||||||
timeinfo = localtime(&rawtime);
|
timeinfo = localtime_r(&rawtime, &timetmp);
|
||||||
strftime(buffer, 100, "%F %H:%M:%S", timeinfo);
|
strftime(buffer, 100, "%F %H:%M:%S", timeinfo);
|
||||||
dprintf(out, "%s[%s] ", color_time, buffer);
|
dprintf(out, "%s[%s] ", color_time, buffer);
|
||||||
if (progname && progpid && strlen(progname) && strlen(progpid)){
|
if (progname && progpid && strlen(progname) && strlen(progpid)){
|
||||||
|
|
|
@ -180,9 +180,10 @@ int main_loop(int argc, char **argv){
|
||||||
dup2(output, STDERR_FILENO);
|
dup2(output, STDERR_FILENO);
|
||||||
time_t rawtime;
|
time_t rawtime;
|
||||||
struct tm *timeinfo;
|
struct tm *timeinfo;
|
||||||
|
struct tm tmptime;
|
||||||
char buffer[25];
|
char buffer[25];
|
||||||
time(&rawtime);
|
time(&rawtime);
|
||||||
timeinfo = localtime(&rawtime);
|
timeinfo = localtime_r(&rawtime, &tmptime);
|
||||||
strftime(buffer, 25, "%c", timeinfo);
|
strftime(buffer, 25, "%c", timeinfo);
|
||||||
std::cerr << std::endl
|
std::cerr << std::endl
|
||||||
<< std::endl
|
<< std::endl
|
||||||
|
|
|
@ -15,7 +15,8 @@
|
||||||
/// Returns the challenge string for authentication, given the socket connection.
|
/// Returns the challenge string for authentication, given the socket connection.
|
||||||
std::string getChallenge(Socket::Connection & conn){
|
std::string getChallenge(Socket::Connection & conn){
|
||||||
time_t Time = time(0);
|
time_t Time = time(0);
|
||||||
tm * TimeInfo = localtime( &Time);
|
tm tmptime;
|
||||||
|
tm * TimeInfo = localtime_r( &Time, &tmptime);
|
||||||
std::stringstream Date;
|
std::stringstream Date;
|
||||||
Date << TimeInfo->tm_mday << "-" << TimeInfo->tm_mon << "-" << TimeInfo->tm_year + 1900;
|
Date << TimeInfo->tm_mday << "-" << TimeInfo->tm_mon << "-" << TimeInfo->tm_year + 1900;
|
||||||
return Secure::md5(Date.str().c_str() + conn.getHost());
|
return Secure::md5(Date.str().c_str() + conn.getHost());
|
||||||
|
|
Loading…
Add table
Reference in a new issue