Browse Source

Fix #26

Declaring a counter as volatile to avoid GCC opti :/
Yann Weber 5 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,7 +237,7 @@ exit_err:
237 237
 
238 238
 int pyfcgi_logger_format_bufinit(pyfcgi_logger_format_t* fmt)
239 239
 {
240
-	unsigned short i;
240
+	volatile unsigned short i;
241 241
 	size_t pre_sz, suf_sz;
242 242
 	char *cur, pid[PYFCGI_LOG_PID_LEN];
243 243
 	fmt->buf = fmt->prefix = fmt->suffix = NULL;
@@ -316,7 +316,7 @@ int pyfcgi_logger_format_bufinit(pyfcgi_logger_format_t* fmt)
316 316
 						fmt->fields[i].len);
317 317
 					break;
318 318
 				case pyfcgi_logger_field_ident:
319
-					memcpy(cur, *((char**)fmt->fields[i].val),
319
+					memcpy(cur, PyFCGI_conf.logs.ident,
320 320
 						fmt->fields[i].len);
321 321
 					break;
322 322
 				case pyfcgi_logger_field_pid:
@@ -579,6 +579,11 @@ int pyfcgi_logger_set_ident(const char* new_ident)
579 579
 	short upd;
580 580
 
581 581
 	conf = &PyFCGI_conf.logs;
582
+	if(conf->ident)
583
+	{
584
+		free(conf->ident);
585
+	}
586
+
582 587
 	if( !(conf->ident = strdup(new_ident)) )
583 588
 	{
584 589
 		pyfcgi_log(LOG_ALERT,

Loading…
Cancel
Save