aboutsummaryrefslogtreecommitdiffstats
path: root/scd
diff options
context:
space:
mode:
Diffstat (limited to 'scd')
-rw-r--r--scd/ChangeLog12
-rw-r--r--scd/Makefile.am2
-rw-r--r--scd/apdu.c2
-rw-r--r--scd/command.c20
-rw-r--r--scd/scdaemon.c9
-rw-r--r--scd/scdaemon.h1
6 files changed, 42 insertions, 4 deletions
diff --git a/scd/ChangeLog b/scd/ChangeLog
index 2e9024e20..ad517f12a 100644
--- a/scd/ChangeLog
+++ b/scd/ChangeLog
@@ -1,3 +1,15 @@
+2007-06-12 Werner Koch <[email protected]>
+
+ * scdaemon.c (main): Replace some calls by init_common_subsystems.
+
+2007-06-11 Werner Koch <[email protected]>
+
+ * Makefile.am (scdaemon_LDADD): Use libcommonpth macro.
+
+ * command.c (initialize_module_command): New.
+ * scdaemon.c (main) [W32]: Do not use sigpipe code.
+ (main): Call initialize_module_command.
+
2007-06-06 Werner Koch <[email protected]>
* app-openpgp.c (do_sign): Fix arithmetic on void*.
diff --git a/scd/Makefile.am b/scd/Makefile.am
index 448211623..c51da4795 100644
--- a/scd/Makefile.am
+++ b/scd/Makefile.am
@@ -44,7 +44,7 @@ scdaemon_SOURCES = \
app.c app-common.h app-help.c $(card_apps)
-scdaemon_LDADD = ../jnlib/libjnlib.a ../common/libcommonpth.a ../gl/libgnu.a \
+scdaemon_LDADD = ../jnlib/libjnlib.a $(libcommonpth) ../gl/libgnu.a \
$(LIBGCRYPT_LIBS) $(KSBA_LIBS) $(LIBASSUAN_PTH_LIBS) $(PTH_LIBS) \
$(LIBUSB_LIBS) $(GPG_ERROR_LIBS) \
$(LIBINTL) $(DL_LIBS) $(NETLIBS) $(LIBICONV)
diff --git a/scd/apdu.c b/scd/apdu.c
index 57faa7006..7a29ed70e 100644
--- a/scd/apdu.c
+++ b/scd/apdu.c
@@ -1337,6 +1337,8 @@ open_pcsc_reader (const char *portstr)
int err;
unsigned int dummy_status;
int sw = SW_HOST_CARD_IO_ERROR;
+ /* Note that we use the constant and not the fucntion because this
+ code won't be be used under Windows. */
const char *wrapperpgm = GNUPG_LIBEXECDIR "/gnupg-pcsc-wrapper";
if (access (wrapperpgm, X_OK))
diff --git a/scd/command.c b/scd/command.c
index 93df064af..3ffa5afb6 100644
--- a/scd/command.c
+++ b/scd/command.c
@@ -124,7 +124,7 @@ static struct server_local_s *locked_session;
/* While doing a reset we need to make sure that the ticker does not
call scd_update_reader_status_file while we are using it. */
-static pth_mutex_t status_file_update_lock = PTH_MUTEX_INIT;
+static pth_mutex_t status_file_update_lock;
/*-- Local prototypes --*/
@@ -132,6 +132,24 @@ static void update_reader_status_file (void);
+
+/* This function must be called once to initialize this module. This
+ has to be done before a second thread is spawned. We can't do the
+ static initialization because Pth emulation code might not be able
+ to do a static init; in particular, it is not possible for W32. */
+void
+initialize_module_command (void)
+{
+ static int initialized;
+
+ if (!initialized)
+ {
+ if (pth_mutex_init (&status_file_update_lock))
+ initialized = 1;
+ }
+}
+
+
/* Update the CARD_REMOVED element of all sessions using the reader
given by SLOT to VALUE */
static void
diff --git a/scd/scdaemon.c b/scd/scdaemon.c
index ea97a392c..4fe0918b6 100644
--- a/scd/scdaemon.c
+++ b/scd/scdaemon.c
@@ -303,8 +303,9 @@ main (int argc, char **argv )
when adding any stuff between here and the call to INIT_SECMEM()
somewhere after the option parsing */
log_set_prefix ("scdaemon", 1|4);
- /* Try to auto set the character set. */
- set_native_charset (NULL);
+
+ /* Make sure that our subsystems are ready. */
+ init_common_subsystems ();
i18n_init ();
@@ -522,6 +523,8 @@ main (int argc, char **argv )
log_debug ("... okay\n");
}
+ initialize_module_command ();
+
if (gpgconf_list == 2)
scd_exit (0);
if (gpgconf_list)
@@ -586,6 +589,7 @@ main (int argc, char **argv )
pth_attr_t tattr;
int fd = -1;
+#ifndef HAVE_W32_SYSTEM
{
struct sigaction sa;
@@ -594,6 +598,7 @@ main (int argc, char **argv )
sa.sa_flags = 0;
sigaction (SIGPIPE, &sa, NULL);
}
+#endif
/* If --debug-allow-core-dump has been given we also need to
switch the working directory to a place where we can actually
diff --git a/scd/scdaemon.h b/scd/scdaemon.h
index 7e5b9fb9b..e1c5109d5 100644
--- a/scd/scdaemon.h
+++ b/scd/scdaemon.h
@@ -124,6 +124,7 @@ void scd_exit (int rc);
const char *scd_get_socket_name (void);
/*-- command.c --*/
+void initialize_module_command (void);
void scd_command_handler (ctrl_t, int);
void send_status_info (ctrl_t ctrl, const char *keyword, ...)
GNUPG_GCC_A_SENTINEL(1);