|
@@ -35,21 +35,36 @@ int pyfcgi_logger_stop()
|
35
|
35
|
void pyfcgi_logger_enable_syslog(const char* nident)
|
36
|
36
|
{
|
37
|
37
|
pyfcgi_conf_logger_t *conf;
|
|
38
|
+ char ident[64];
|
|
39
|
+ size_t ret;
|
|
40
|
+
|
38
|
41
|
conf = &PyFCGI_conf.logs;
|
39
|
42
|
if(conf->flags & PYFCGI_LOG_FSYSLOG)
|
40
|
43
|
{
|
41
|
44
|
closelog();
|
42
|
45
|
}
|
43
|
46
|
conf->flags |= PYFCGI_LOG_FSYSLOG;
|
44
|
|
- if(!nident)
|
|
47
|
+
|
|
48
|
+ ret = 0;
|
|
49
|
+ if(nident)
|
45
|
50
|
{
|
46
|
|
- nident = conf->ident;
|
|
51
|
+ ret = snprintf(ident, 64, PYFCGI_SYSLOG_IDENT_FMT,
|
|
52
|
+ getpid(), nident);
|
|
53
|
+ }
|
|
54
|
+ if(!nident || ret >= 64)
|
|
55
|
+ {
|
|
56
|
+ ret = snprintf(ident, 64, PYFCGI_SYSLOG_IDENT_FMT_SHORT,
|
|
57
|
+ getpid());
|
|
58
|
+ if(ret <= 64)
|
|
59
|
+ {
|
|
60
|
+ snprintf(ident, 64, "pyfcgi");
|
|
61
|
+ }
|
47
|
62
|
}
|
48
|
63
|
if(conf->syslog_ident)
|
49
|
64
|
{
|
50
|
65
|
free(conf->syslog_ident);
|
51
|
66
|
}
|
52
|
|
- conf->syslog_ident = strdup(nident);
|
|
67
|
+ conf->syslog_ident = strdup(ident);
|
53
|
68
|
openlog(conf->syslog_ident, LOG_CONS | LOG_PERROR, LOG_DAEMON | LOG_USER);
|
54
|
69
|
}
|
55
|
70
|
|