Skip to content

Commit

Permalink
Merge branch 'master' into seccomp
Browse files Browse the repository at this point in the history
  • Loading branch information
leifj committed Sep 4, 2012
2 parents 38456eb + 9e6cb3c commit 5c387c0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions config.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef CONFIG_H
# define CONFIG_H

# define DEBUG_OUTPUT 0 // change to 1 to enable debugging

#ifdef __MINGW32__

# include <stdint.h>
Expand Down
4 changes: 4 additions & 0 deletions gck-rpc-daemon-standalone.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
#include <dlfcn.h>
#include <pthread.h>

#include <syslog.h>

#ifdef __MINGW32__
# include <winsock2.h>
#endif
Expand Down Expand Up @@ -139,6 +141,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) {
Expand Down
8 changes: 7 additions & 1 deletion gck-rpc-dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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);
}
Expand Down

0 comments on commit 5c387c0

Please sign in to comment.