Ticket #22656: patch-src-screen.diff
File patch-src-screen.diff, 1.8 KB (added by arm39@…, 15 years ago) |
---|
-
src/screen.c
static void 228 228 static void 229 229 flag_vputf(DCDisplayFlag flag, const char *format, va_list args) 230 230 { 231 //va_list args2; 231 if (log_fh != NULL && log_flags & flag) { 232 char c_time[1024]; 233 time_t now = time(NULL); 234 struct tm _tm = {0}; 235 va_list args_dup; 232 236 233 //va_copy(args2, args); 237 if (NULL != localtime_r(&now, &_tm) && 0 != strftime(c_time, 1023, "%d.%m.%Y %H:%M:%S", &_tm)) { 238 fprintf(log_fh, "%s ", c_time); 239 } 234 240 241 // args would become undefined after xvasprintf() call, so make a copy 242 // of args to use it later below. 243 va_copy(args_dup, args); 244 char* msg = xvasprintf(format, args_dup); 245 va_end(args_dup); 246 247 char* log_msg = main_to_log_string(msg); 248 free(msg); 249 fprintf(log_fh, log_msg); 250 free(log_msg); 251 fflush(log_fh); 252 } 253 235 254 if (display_flags & flag) { 236 255 if (screen_state == SCREEN_SUSPENDED) { 237 256 ptrv_append(suspend_msgs, xvasprintf(format, args)); … … flag_vputf(DCDisplayFlag flag, const cha 243 262 vprintf(format, args); 244 263 fflush(stdout); 245 264 } 246 }247 if (log_fh != NULL && log_flags & flag) {248 char c_time[1024];249 time_t now = time(NULL);250 struct tm _tm = {0};251 if (NULL != localtime_r(&now, &_tm) && 0 != strftime(c_time, 1023, "%d.%m.%Y %H:%M:%S", &_tm)) {252 fprintf(log_fh, "%s ", c_time);253 }254 char* msg = xvasprintf(format, args);255 //va_end(args2);256 char* log_msg = main_to_log_string(msg);257 free(msg);258 fprintf(log_fh, log_msg);259 free(log_msg);260 fflush(log_fh);261 265 } 262 266 }