Skip to content
Snippets Groups Projects
Commit 9e6cb3cd authored by Leif Johansson's avatar Leif Johansson
Browse files

- disable debugging by default

- use syslog instead of stderr unless DEBUG_OUTPUT is 1
parent 4c918f96
No related branches found
No related tags found
No related merge requests found
#ifndef CONFIG_H
# define CONFIG_H
# define DEBUG_OUTPUT 0 // change to 1 to enable debugging
#ifdef __MINGW32__
# include <stdint.h>
......
......@@ -36,6 +36,8 @@
#include <dlfcn.h>
#include <pthread.h>
#include <syslog.h>
#ifdef __MINGW32__
# include <winsock2.h>
#endif
......@@ -76,6 +78,8 @@ int main(int argc, char *argv[])
if (argc != 2 && argc != 3)
usage();
openlog("pkcs11-proxy",LOG_CONS|LOG_PID,LOG_DAEMON);
/* Load the library */
module = dlopen(argv[1], RTLD_NOW);
if (!module) {
......
......@@ -48,6 +48,7 @@
#include <unistd.h>
#include <errno.h>
#include <stdio.h>
#include <syslog.h>
/* Where we dispatch the calls to */
static CK_FUNCTION_LIST_PTR pkcs11_module = NULL;
......@@ -83,8 +84,9 @@ static pthread_mutex_t pkcs11_dispatchers_mutex = PTHREAD_MUTEX_INITIALIZER;
/* -----------------------------------------------------------------------------
* LOGGING and DEBUGGING
*/
#undef DEBUG_OUTPUT
#ifndef DEBUG_OUTPUT
#define DEBUG_OUTPUT 1
#endif
#if DEBUG_OUTPUT
#define debug(x) gck_rpc_debug x
#else
......@@ -101,7 +103,11 @@ void gck_rpc_log(const char *msg, ...)
va_list ap;
va_start(ap, msg);
#if DEBUG_OUTPUT
vfprintf(stderr, msg, ap);
#else
vsyslog(LOG_INFO,msg,ap);
#endif
printf("\n");
va_end(ap);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment