Browse Source

Fix #26

Declaring a counter as volatile to avoid GCC opti :/
Yann Weber 4 years ago
parent
commit
89d69a26e6
1 changed files with 7 additions and 2 deletions
  1. 7
    2
      src/logger.c

+ 7
- 2
src/logger.c View File

237
 
237
 
238
 int pyfcgi_logger_format_bufinit(pyfcgi_logger_format_t* fmt)
238
 int pyfcgi_logger_format_bufinit(pyfcgi_logger_format_t* fmt)
239
 {
239
 {
240
-	unsigned short i;
240
+	volatile unsigned short i;
241
 	size_t pre_sz, suf_sz;
241
 	size_t pre_sz, suf_sz;
242
 	char *cur, pid[PYFCGI_LOG_PID_LEN];
242
 	char *cur, pid[PYFCGI_LOG_PID_LEN];
243
 	fmt->buf = fmt->prefix = fmt->suffix = NULL;
243
 	fmt->buf = fmt->prefix = fmt->suffix = NULL;
316
 						fmt->fields[i].len);
316
 						fmt->fields[i].len);
317
 					break;
317
 					break;
318
 				case pyfcgi_logger_field_ident:
318
 				case pyfcgi_logger_field_ident:
319
-					memcpy(cur, *((char**)fmt->fields[i].val),
319
+					memcpy(cur, PyFCGI_conf.logs.ident,
320
 						fmt->fields[i].len);
320
 						fmt->fields[i].len);
321
 					break;
321
 					break;
322
 				case pyfcgi_logger_field_pid:
322
 				case pyfcgi_logger_field_pid:
579
 	short upd;
579
 	short upd;
580
 
580
 
581
 	conf = &PyFCGI_conf.logs;
581
 	conf = &PyFCGI_conf.logs;
582
+	if(conf->ident)
583
+	{
584
+		free(conf->ident);
585
+	}
586
+
582
 	if( !(conf->ident = strdup(new_ident)) )
587
 	if( !(conf->ident = strdup(new_ident)) )
583
 	{
588
 	{
584
 		pyfcgi_log(LOG_ALERT,
589
 		pyfcgi_log(LOG_ALERT,

Loading…
Cancel
Save