diff options
| author | luigi1111 <luigi1111w@gmail.com> | 2018-06-25 15:21:25 -0500 |
|---|---|---|
| committer | luigi1111 <luigi1111w@gmail.com> | 2018-06-25 15:21:25 -0500 |
| commit | c0c6102260a4f623218ee34286dd7bf4240c7609 (patch) | |
| tree | f5d4689477382297cfbde40c4bdf8abb2a9578c1 | |
| parent | a2b08db9c9c0e2958a22577b9586454eab21d550 (diff) | |
| parent | 87665281ea6044d313c9b863879758dfea6b9299 (diff) | |
| download | monzero-core-c0c6102260a4f623218ee34286dd7bf4240c7609.tar.gz monzero-core-c0c6102260a4f623218ee34286dd7bf4240c7609.tar.xz monzero-core-c0c6102260a4f623218ee34286dd7bf4240c7609.zip | |
Merge pull request #3972
8766528 epee: fallback to a counter if gmtime fails when rotating logs (moneromooo-monero)
| -rw-r--r-- | contrib/epee/src/mlog.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/contrib/epee/src/mlog.cpp b/contrib/epee/src/mlog.cpp index 0759f5d34..e8248c958 100644 --- a/contrib/epee/src/mlog.cpp +++ b/contrib/epee/src/mlog.cpp @@ -47,6 +47,7 @@ using namespace epee; static std::string generate_log_filename(const char *base) { std::string filename(base); + static unsigned int fallback_counter = 0; char tmp[200]; struct tm tm; time_t now = time(NULL); @@ -56,7 +57,7 @@ static std::string generate_log_filename(const char *base) #else (!gmtime_r(&now, &tm)) #endif - strcpy(tmp, "unknown"); + snprintf(tmp, sizeof(tmp), "part-%u", ++fallback_counter); else strftime(tmp, sizeof(tmp), "%Y-%m-%d-%H-%M-%S", &tm); tmp[sizeof(tmp) - 1] = 0; |
