]> TLD Linux GIT Repositories - packages/pcsc-lite.git/blob - debuglog-pid.patch
- from PLD
[packages/pcsc-lite.git] / debuglog-pid.patch
1 --- pcsc-lite-1.6.6/src/debuglog.c~     2010-06-30 15:40:58.000000000 +0300
2 +++ pcsc-lite-1.6.6/src/debuglog.c      2011-01-12 01:58:18.693291099 +0200
3 @@ -104,6 +104,8 @@
4  {
5         char DebugBuffer[DEBUG_BUF_SIZE];
6         va_list argptr;
7 +       // boolean not to do openlog several times
8 +       static int syslog_opened = 0;
9  
10         if ((LogSuppress != DEBUGLOG_LOG_ENTRIES)
11                 || (priority < LogLevel) /* log priority lower than threshold? */
12 @@ -114,13 +116,18 @@
13         vsnprintf(DebugBuffer, DEBUG_BUF_SIZE, fmt, argptr);
14         va_end(argptr);
15  
16 +       if (DEBUGLOG_SYSLOG_DEBUG == LogMsgType && !syslog_opened) {
17 +               openlog(NULL, LOG_PID, LOG_DAEMON);
18 +               syslog_opened = 1;
19 +       }
20 +
21         log_line(priority, DebugBuffer);
22  } /* log_msg */
23  
24  static void log_line(const int priority, const char *DebugBuffer)
25  {
26         if (DEBUGLOG_SYSLOG_DEBUG == LogMsgType)
27 -               syslog(LOG_INFO, "%s", DebugBuffer);
28 +               syslog(LOG_DEBUG, "%s", DebugBuffer);
29         else
30         {
31                 if (LogDoColor)