diff options
Diffstat (limited to 'toxcore/util.c')
-rw-r--r-- | toxcore/util.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/toxcore/util.c b/toxcore/util.c index 7b2735a0..acd47daf 100644 --- a/toxcore/util.c +++ b/toxcore/util.c | |||
@@ -108,11 +108,14 @@ void loginit(uint16_t port) | |||
108 | starttime = now(); | 108 | starttime = now(); |
109 | 109 | ||
110 | struct tm *tm = localtime(&starttime); | 110 | struct tm *tm = localtime(&starttime); |
111 | |||
111 | if (strftime(logbuffer + 32, sizeof(logbuffer) - 32, "%F %T", tm)) | 112 | if (strftime(logbuffer + 32, sizeof(logbuffer) - 32, "%F %T", tm)) |
112 | sprintf(logbuffer, "%u-%s.log", ntohs(port), logbuffer + 32); | 113 | sprintf(logbuffer, "%u-%s.log", ntohs(port), logbuffer + 32); |
113 | else | 114 | else |
114 | sprintf(logbuffer, "%u-%lu.log", ntohs(port), starttime); | 115 | sprintf(logbuffer, "%u-%lu.log", ntohs(port), starttime); |
116 | |||
115 | logfile = fopen(logbuffer, "w"); | 117 | logfile = fopen(logbuffer, "w"); |
118 | |||
116 | if (logbufferpredata) { | 119 | if (logbufferpredata) { |
117 | if (logfile) | 120 | if (logfile) |
118 | fprintf(logfile, logbufferpredata); | 121 | fprintf(logfile, logbufferpredata); |
@@ -135,6 +138,7 @@ void loglog(char *text) | |||
135 | /* log messages before file was opened: store */ | 138 | /* log messages before file was opened: store */ |
136 | 139 | ||
137 | size_t len = strlen(text); | 140 | size_t len = strlen(text); |
141 | |||
138 | if (!starttime) { | 142 | if (!starttime) { |
139 | starttime = now(); | 143 | starttime = now(); |
140 | logbufferprelen = 1024 + len - (len % 1024); | 144 | logbufferprelen = 1024 + len - (len % 1024); |