Changeset 3118
- Timestamp:
- 09/21/10 10:17:55 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/threaded/oscam-log.c
r3117 r3118 9 9 static int use_syslog=0; 10 10 static int use_stdout=0; 11 static char *log_txt;12 static char *log_buf;11 static char log_txt[512]; 12 static char log_buf[700]; 13 13 14 14 pthread_mutex_t log_mutex = PTHREAD_MUTEX_INITIALIZER; … … 80 80 { 81 81 static char *head = ">> OSCam << cardserver started version " CS_VERSION ", build #" CS_SVN_VERSION " (" CS_OSTYPE ")"; 82 83 log_txt = malloc(512);84 log_buf = malloc(700);85 82 86 83 if (!strcmp(file, "stdout")) { … … 213 210 void cs_log(char *fmt,...) 214 211 { 215 if (!log_txt)216 return;217 212 pthread_mutex_lock(&log_mutex); 218 213 get_log_header(1, log_txt); … … 227 222 void cs_close_log(void) 228 223 { 229 if (log_txt) { 230 cs_log("LOG CLOSED"); 231 free(log_buf); 232 free(log_txt); 233 log_txt = NULL; 234 log_buf = NULL; 235 } 224 cs_log("LOG CLOSED"); 236 225 if (use_stdout || use_syslog || !fp) return; 237 226 fclose(fp); … … 243 232 // cs_log("cs_debug called, cs_ptyp=%d, cs_dblevel=%d, %d", cs_ptyp, client[cs_idx].dbglvl ,client[cs_idx].cs_ptyp & client[cs_idx].dbglvl); 244 233 pthread_mutex_lock(&log_mutex); 245 if ( log_txt &&client[cs_idx].dbglvl & client[cs_idx].cs_ptyp)234 if (client[cs_idx].dbglvl & client[cs_idx].cs_ptyp) 246 235 { 247 236 get_log_header(1, log_txt); … … 258 247 { 259 248 pthread_mutex_lock(&log_mutex); 260 if ( log_txt &&client[cs_idx].dbglvl & mask)249 if (client[cs_idx].dbglvl & mask) 261 250 { 262 251 get_log_header(1, log_txt); … … 273 262 { 274 263 pthread_mutex_lock(&log_mutex); 275 if ( log_txt &&client[cs_idx].dbglvl & client[cs_idx].cs_ptyp)264 if (client[cs_idx].dbglvl & client[cs_idx].cs_ptyp) 276 265 { 277 266 va_list params; … … 291 280 void cs_dump(uchar *buf, int n, char *fmt, ...) 292 281 { 293 if (!log_txt)294 return;295 282 pthread_mutex_lock(&log_mutex); 296 283 int i; … … 318 305 void cs_ddump(uchar *buf, int n, char *fmt, ...) 319 306 { 320 if (!log_txt)321 return;322 307 pthread_mutex_lock(&log_mutex); 323 308 int i; … … 350 335 { 351 336 352 if(!log_txt)353 return;354 337 int i; 355 338 pthread_mutex_lock(&log_mutex);
Note:
See TracChangeset
for help on using the changeset viewer.