summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2010-03-22 13:46:05 +0100
committerWerner Koch <wk@gnupg.org>2010-03-22 13:46:05 +0100
commite64038608be28c14ed72b0372529762953de898f (patch)
tree3847da576d4f2e6c542ce6737179a11afcc1a487
parentBuilds again for W32. (diff)
downloadgnupg2-e64038608be28c14ed72b0372529762953de898f.tar.xz
gnupg2-e64038608be28c14ed72b0372529762953de898f.zip
More chnages to use estream. Add a way to replace the standard
descriptors.
-rw-r--r--agent/gpg-agent.c4
-rw-r--r--agent/preset-passphrase.c2
-rw-r--r--agent/protect-tool.c2
-rwxr-xr-xautogen.sh4
-rw-r--r--common/ChangeLog37
-rw-r--r--common/Makefile.am5
-rw-r--r--common/argparse.c2
-rw-r--r--common/asshelp.c2
-rw-r--r--common/dns-cert.c7
-rw-r--r--common/estream.c41
-rw-r--r--common/estream.h3
-rw-r--r--common/exechelp.c8
-rw-r--r--common/http.c2
-rw-r--r--common/init.c93
-rw-r--r--common/init.h2
-rw-r--r--common/logging.c37
-rw-r--r--common/pka.c2
-rw-r--r--common/signal.c35
-rw-r--r--common/sysutils.c2
-rw-r--r--common/t-sysutils.c4
-rw-r--r--common/util.h1
-rw-r--r--configure.ac2
-rw-r--r--g10/gpg.c2
-rw-r--r--g10/gpgv.c2
-rw-r--r--g13/g13.c2
-rw-r--r--kbx/kbxutil.c2
-rw-r--r--scd/scdaemon.c2
-rw-r--r--sm/gpgsm.c2
-rw-r--r--sm/server.c2
-rw-r--r--tools/gpg-check-pattern.c2
-rw-r--r--tools/gpg-connect-agent.c2
-rw-r--r--tools/gpgconf.c2
-rw-r--r--tools/symcryptrun.c2
33 files changed, 241 insertions, 78 deletions
diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
index 4ff5774dc..ee4bb2f17 100644
--- a/agent/gpg-agent.c
+++ b/agent/gpg-agent.c
@@ -589,7 +589,7 @@ main (int argc, char **argv )
/* Make sure that our subsystems are ready. */
i18n_init ();
- init_common_subsystems ();
+ init_common_subsystems (&argc, &argv);
/* Libgcrypt requires us to register the threading model first.
@@ -1385,7 +1385,7 @@ get_agent_scd_notify_event (void)
HANDLE h, h2;
SECURITY_ATTRIBUTES sa = { sizeof (SECURITY_ATTRIBUTES), NULL, TRUE};
- /* We need to use manual reset evet object due to the way our
+ /* We need to use a manual reset event object due to the way our
w32-pth wait function works: If we would use an automatic
reset event we are not able to figure out which handle has
been signaled because at the time we single out the signaled
diff --git a/agent/preset-passphrase.c b/agent/preset-passphrase.c
index 8e3b3e2c5..89542c67e 100644
--- a/agent/preset-passphrase.c
+++ b/agent/preset-passphrase.c
@@ -210,7 +210,7 @@ main (int argc, char **argv)
/* Make sure that our subsystems are ready. */
i18n_init ();
- init_common_subsystems ();
+ init_common_subsystems (&argc, &argv);
opt_homedir = default_homedir ();
diff --git a/agent/protect-tool.c b/agent/protect-tool.c
index 4008a8867..0fc2002ee 100644
--- a/agent/protect-tool.c
+++ b/agent/protect-tool.c
@@ -1025,7 +1025,7 @@ main (int argc, char **argv )
/* Make sure that our subsystems are ready. */
i18n_init ();
- init_common_subsystems ();
+ init_common_subsystems (&argc, &argv);
if (!gcry_check_version (NEED_LIBGCRYPT_VERSION) )
{
diff --git a/autogen.sh b/autogen.sh
index f7bab4a25..b943c6f77 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -76,10 +76,12 @@ if [ "$myhost" = "w32" ]; then
fi
build=`$tsdir/scripts/config.guess`
+ extraoptions=""
case $myhostsub in
ce)
[ -z "$w32root" ] && w32root="$HOME/w32ce_root"
toolprefixes="arm-mingw32ce"
+ extraoptions="--disable-scdaemon"
;;
*)
[ -z "$w32root" ] && w32root="$HOME/w32root"
@@ -124,7 +126,7 @@ if [ "$myhost" = "w32" ]; then
--with-regex=${w32root} \
--with-pth-prefix=${w32root} \
--with-adns=${w32root} \
- --disable-g13 "$@"
+ ${extraoptions} --disable-g13 "$@"
rc=$?
exit $rc
fi
diff --git a/common/ChangeLog b/common/ChangeLog
index c42c1f563..f4a8833ab 100644
--- a/common/ChangeLog
+++ b/common/ChangeLog
@@ -1,5 +1,42 @@
+2010-03-22 Werner Koch <wk@g10code.com>
+
+ * init.c (parse_std_file_handles): Change to use rendezvous ids.
+
2010-03-15 Werner Koch <wk@g10code.com>
+ * init.c (init_common_subsystems): Add args ARGCP and
+ ARGVP. Change all callers to provide them.
+ (parse_std_file_handles): New.
+
+ * t-sysutils.c (rewind) [W32CE]: Provide a replacement.
+
+ * Makefile.am (module_tests) [W32CE]: Don't build t-exechelp for now.
+
+ * sysutils.c (gnupg_allow_set_foregound_window) [W32CE]: Don't
+ call AllowSetForegroundWindow.
+
+ * logging.c (isatty) [W32CE]: New.
+ (fun_writer, set_file_fd): Use estream even for the internal error
+ messages.
+ (log_string, log_flush): Make DUMMY_ARG_PTR static.
+
+2010-03-15 Werner Koch <wk@g10code.com>
+
+ * asshelp.c (send_pinentry_environment) [!HAVE_SETLOCALE]: Do not
+ define OLD_LC.
+ * http.c (connect_server) [!USE_DNS_SRV]: Mark SRVTAG unused.
+ * dns-cert.c (get_dns_cert) [!USE_DNS_CERT]: Mark args unused.
+ * pka.c (get_pka_info): Ditto.
+
+ * signal.c (pause_on_sigusr): Remove. It was used in ancient gpg
+ version with shared memory IPC. Last caller removed on 2006-04-18.
+ (do_block) [W32]: Mark arg unused.
+
+ * exechelp.c (w32_open_null): Use CreateFileW.
+
+ * init.c (init_common_subsystems): Add args ARGCP and ARGVP.
+ Change all callers to pass them.
+
* logging.c (S_IRGRP, S_IROTH, S_IWGRP, S_IWOTH) [W32]: New.
(fun_writer, set_file_fd) [W32]: Disable socket code.
diff --git a/common/Makefile.am b/common/Makefile.am
index 1a73d31b1..9a9cd4444 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -142,8 +142,11 @@ jnlib_tests = t-stringhelp t-timestuff
if HAVE_W32_SYSTEM
jnlib_tests += t-w32-reg
endif
-module_tests = t-convert t-percent t-gettime t-sysutils t-sexputil t-exechelp \
+module_tests = t-convert t-percent t-gettime t-sysutils t-sexputil \
t-session-env
+if !HAVE_W32CE_SYSTEM
+module_tests += t-exechelp
+endif
module_maint_tests = t-helpfile t-b64
diff --git a/common/argparse.c b/common/argparse.c
index ab88922a4..28b4007b9 100644
--- a/common/argparse.c
+++ b/common/argparse.c
@@ -1131,6 +1131,8 @@ strusage( int level )
return p;
}
+
+/* Set the usage handler. This function is basically a constructor. */
void
set_strusage ( const char *(*f)( int ) )
{
diff --git a/common/asshelp.c b/common/asshelp.c
index f9878f3b3..0f744ad00 100644
--- a/common/asshelp.c
+++ b/common/asshelp.c
@@ -103,7 +103,9 @@ send_pinentry_environment (assuan_context_t ctx,
{
gpg_error_t err = 0;
+#if defined(HAVE_SETLOCALE)
char *old_lc = NULL;
+#endif
char *dft_lc = NULL;
const char *dft_ttyname;
int iterator;
diff --git a/common/dns-cert.c b/common/dns-cert.c
index efdefaf16..80ba7d06d 100644
--- a/common/dns-cert.c
+++ b/common/dns-cert.c
@@ -279,6 +279,13 @@ get_dns_cert (const char *name, size_t max_size, IOBUF *iobuf,
return ret;
#endif /*!USE_ADNS*/
#else /* !USE_DNS_CERT */
+ (void)name;
+ (void)max_size;
+ (void)iobuf;
+ (void)fpr;
+ (void)fpr_len;
+ (void)url;
+
return -1;
#endif
}
diff --git a/common/estream.c b/common/estream.c
index 075a56564..41ba4f245 100644
--- a/common/estream.c
+++ b/common/estream.c
@@ -245,6 +245,11 @@ static estream_mutex_t estream_list_lock;
#define ESTREAM_LIST_LOCK ESTREAM_MUTEX_LOCK (estream_list_lock)
#define ESTREAM_LIST_UNLOCK ESTREAM_MUTEX_UNLOCK (estream_list_lock)
+/* File descriptors registered to be used as the standard file handles. */
+static int custom_std_fds[3];
+static unsigned char custom_std_fds_valid[3];
+
+
#ifndef EOPNOTSUPP
# define EOPNOTSUPP ENOSYS
#endif
@@ -2239,7 +2244,7 @@ es_fopencookie (void *ES__RESTRICT cookie,
estream_t
-do_fdopen (int filedes, const char *mode, int no_close)
+do_fdopen (int filedes, const char *mode, int no_close, int with_locked_list)
{
unsigned int modeflags;
int create_called;
@@ -2261,7 +2266,7 @@ do_fdopen (int filedes, const char *mode, int no_close)
create_called = 1;
err = es_create (&stream, cookie, filedes, estream_functions_fd,
- modeflags, 0);
+ modeflags, with_locked_list);
out:
@@ -2274,14 +2279,14 @@ do_fdopen (int filedes, const char *mode, int no_close)
estream_t
es_fdopen (int filedes, const char *mode)
{
- return do_fdopen (filedes, mode, 0);
+ return do_fdopen (filedes, mode, 0, 0);
}
/* A variant of es_fdopen which does not close FILEDES at the end. */
estream_t
es_fdopen_nc (int filedes, const char *mode)
{
- return do_fdopen (filedes, mode, 1);
+ return do_fdopen (filedes, mode, 1, 0);
}
@@ -2344,6 +2349,23 @@ es_fpopen_nc (FILE *fp, const char *mode)
}
+/* Set custom standard descriptors to be used for stdin, stdout and
+ stderr. This function needs to be called before any of the
+ standard streams are accessed. */
+void
+_es_set_std_fd (int no, int fd)
+{
+ ESTREAM_LIST_LOCK;
+ if (no >= 0 && no < 3 && !custom_std_fds_valid[no])
+ {
+ custom_std_fds[no] = fd;
+ custom_std_fds_valid[no] = 1;
+ }
+ ESTREAM_LIST_UNLOCK;
+}
+
+
+/* Return the stream used for stdin, stdout or stderr. */
estream_t
_es_get_std_stream (int fd)
{
@@ -2361,6 +2383,17 @@ _es_get_std_stream (int fd)
}
if (!stream)
{
+ /* Standard stream not yet created. We first try to create them
+ from registered file descriptors. */
+ if (!fd && custom_std_fds_valid[0])
+ stream = do_fdopen (custom_std_fds[0], "r", 1, 1);
+ else if (fd == 1 && custom_std_fds_valid[1])
+ stream = do_fdopen (custom_std_fds[1], "a", 1, 1);
+ else if (custom_std_fds_valid[2])
+ stream = do_fdopen (custom_std_fds[1], "a", 1, 1);
+ }
+ if (!stream)
+ {
/* Standard stream not yet created - do it now. */
if (!fd)
stream = do_fpopen (stdin, "r", 1, 1);
diff --git a/common/estream.h b/common/estream.h
index 67856bf76..f63864e67 100644
--- a/common/estream.h
+++ b/common/estream.h
@@ -80,6 +80,7 @@
#define es_fdopen_nc _ESTREAM_PREFIX(es_fdopen_nc)
#define es_fpopen _ESTREAM_PREFIX(es_fpopen)
#define es_fpopen_nc _ESTREAM_PREFIX(es_fpopen_nc)
+#define _es_set_std_fd _ESTREAM_PREFIX(_es_set_std_fd)
#define _es_get_std_stream _ESTREAM_PREFIX(_es_get_std_stream)
#define es_freopen _ESTREAM_PREFIX(es_freopen)
#define es_fopencookie _ESTREAM_PREFIX(es_fopencookie)
@@ -251,6 +252,7 @@ int es_fclose (estream_t stream);
int es_fileno (estream_t stream);
int es_fileno_unlocked (estream_t stream);
+void _es_set_std_fd (int no, int fd);
estream_t _es_get_std_stream (int fd);
#define es_stdin _es_get_std_stream (0)
@@ -364,7 +366,6 @@ int es_write_sanitized_utf8_buffer (estream_t stream,
size_t *bytes_written);
#endif /*GNUPG_MAJOR_VERSION*/
-
#ifdef __cplusplus
}
#endif
diff --git a/common/exechelp.c b/common/exechelp.c
index f71cd7349..d156cef5d 100644
--- a/common/exechelp.c
+++ b/common/exechelp.c
@@ -381,10 +381,10 @@ w32_open_null (int for_write)
{
HANDLE hfile;
- hfile = CreateFile ("nul",
- for_write? GENERIC_WRITE : GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL, OPEN_EXISTING, 0, NULL);
+ hfile = CreateFileW (L"nul",
+ for_write? GENERIC_WRITE : GENERIC_READ,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ NULL, OPEN_EXISTING, 0, NULL);
if (hfile == INVALID_HANDLE_VALUE)
log_debug ("can't open `nul': %s\n", w32_strerror (-1));
return hfile;
diff --git a/common/http.c b/common/http.c
index a7f6739e5..bb39768e4 100644
--- a/common/http.c
+++ b/common/http.c
@@ -1600,6 +1600,8 @@ connect_server (const char *server, unsigned short port,
srvcount = getsrv (srvname, &serverlist);
}
}
+#else
+ (void)srvtag;
#endif /*USE_DNS_SRV*/
if (!serverlist)
diff --git a/common/init.c b/common/init.c
index d8e0be7bf..d818856dd 100644
--- a/common/init.c
+++ b/common/init.c
@@ -33,16 +33,23 @@
#include "util.h"
+#ifdef HAVE_W32CE_SYSTEM
+#include <assuan.h>
+static void parse_std_file_handles (int *argcp, char ***argvp);
+#endif /*HAVE_W32CE_SYSTEM*/
+
/* This function is to be used early at program startup to make sure
that some subsystems are initialized. This is in particular
important for W32 to initialize the sockets so that our socket
emulation code used directly as well as in libassuan may be used.
It should best be called before any I/O is done so that setup
- required for logging is ready. CAUTION: This might be called while
- running suid(root). */
+ required for logging is ready. ARGCP and ARGVP are the addresses
+ of the parameters given to main. This function may modify them.
+
+ CAUTION: This might be called while running suid(root). */
void
-init_common_subsystems (void)
+init_common_subsystems (int *argcp, char ***argvp)
{
/* Try to auto set the character set. */
set_native_charset (NULL);
@@ -66,5 +73,85 @@ init_common_subsystems (void)
/* Initialize the Estream library. */
es_init ();
+
+ /* Special hack for Windows CE: We extract some options from arg
+ to setup the standard handles. */
+#ifdef HAVE_W32CE_SYSTEM
+ parse_std_file_handles (argcp, argvp);
+#else
+ (void)argcp;
+ (void)argvp;
+#endif
}
+
+
+/* WindowsCE uses a very strange way of handling the standard streams.
+ There is a function SetStdioPath to associate a standard stream
+ with a file or a device but what we really want is to use pipes as
+ standard streams. Despite that we implement pipes using a device,
+ we would have some limitations on the number of open pipes due to
+ the 3 character limit of device file name. Thus we don't take this
+ path. Another option would be to install a file system driver with
+ support for pipes; this would allow us to get rid of the device
+ name length limitation. However, with GnuPG we can get away be
+ redefining the standard streams and passing the handles to be used
+ on the command line. This has also the advantage that it makes
+ creating a process much easier and does not require the
+ SetStdioPath set and restore game. The caller needs to pass the
+ rendezvous ids using up to three options:
+
+ -&S0=<handle> -&S1=<handle> -&S2=<handle>
+
+ They are all optional but they must be the first arguments on the
+ command line. Parsing stops as soon as an invalid option is found.
+ These rendezvous ids are then used to finish the pipe creation.*/
+#ifdef HAVE_W32CE_SYSTEM
+static void
+parse_std_file_handles (int *argcp, char ***argvp)
+{
+ int argc = *argcp;
+ char **argv = *argvp;
+ const char *s;
+ assuan_fd_t fd;
+ int i;
+ int fixup = 0;
+
+ if (!argc)
+ return;
+
+ for (argc--, argv++; argc; argc--, argv++)
+ {
+ s = *argv;
+ if (*s == '-' && s[1] == '&' && s[2] == 'S'
+ && (s[3] == '0' || s[3] == '1' || s[3] == '2')
+ && s[4] == '='
+ && (strchr ("-01234567890", s[5]) || !strcmp (s+5, "null")))
+ {
+ if (s[5] == 'n')
+ fd = ASSUAN_INVALID_FD;
+ else
+ fd = _assuan_w32ce_finish_pipe (atoi (s+5), s[3] != '0');
+ _es_set_std_fd (s[3] - '0', (int)fd);
+ fixup++;
+ }
+ else
+ break;
+ }
+
+ if (fixup)
+ {
+ argc = *argcp;
+ argc -= fixup;
+ *argcp = argc;
+
+ argv = *argvp;
+ for (i=1; i < argc; i++)
+ argv[i] = argv[i + fixup];
+ for (; i < argc + fixup; i++)
+ argv[i] = NULL;
+ }
+
+
+}
+#endif /*HAVE_W32CE_SYSTEM*/
diff --git a/common/init.h b/common/init.h
index 14dfa7b39..e8fe499d8 100644
--- a/common/init.h
+++ b/common/init.h
@@ -20,7 +20,7 @@
#ifndef GNUPG_COMMON_INIT_H
#define GNUPG_COMMON_INIT_H
-void init_common_subsystems (void);
+void init_common_subsystems (int *argcp, char ***argvp);
#endif /*GNUPG_COMMON_INIT_H*/
diff --git a/common/logging.c b/common/logging.c
index bf47015e7..5641b71e7 100644
--- a/common/logging.c
+++ b/common/logging.c
@@ -52,6 +52,11 @@
#endif
+#ifdef HAVE_W32CE_SYSTEM
+# define isatty(a) (0)
+#endif
+
+
static estream_t logstream;
static int log_socket = -1;
static char prefix_buffer[80];
@@ -138,9 +143,9 @@ fun_writer (void *cookie_arg, const void *buffer, size_t size)
if (cookie->fd == -1)
{
if (!cookie->quiet && !running_detached
- && isatty (fileno (stderr)))
- fprintf (stderr, "failed to create socket for logging: %s\n",
- strerror(errno));
+ && isatty (es_fileno (es_stderr)))
+ es_fprintf (es_stderr, "failed to create socket for logging: %s\n",
+ strerror(errno));
}
else
{
@@ -156,9 +161,9 @@ fun_writer (void *cookie_arg, const void *buffer, size_t size)
if (connect (cookie->fd, (struct sockaddr *) &addr, addrlen) == -1)
{
if (!cookie->quiet && !running_detached
- && isatty (fileno (stderr)))
- fprintf (stderr, "can't connect to `%s': %s\n",
- cookie->name, strerror(errno));
+ && isatty (es_fileno (es_stderr)))
+ es_fprintf (es_stderr, "can't connect to `%s': %s\n",
+ cookie->name, strerror(errno));
close (cookie->fd);
cookie->fd = -1;
}
@@ -193,14 +198,14 @@ fun_writer (void *cookie_arg, const void *buffer, size_t size)
return (ssize_t)size; /* Okay. */
if (!running_detached && cookie->fd != -1
- && isatty (fileno (stderr)))
+ && isatty (es_fileno (es_stderr)))
{
if (*cookie->name)
- fprintf (stderr, "error writing to `%s': %s\n",
- cookie->name, strerror(errno));
+ es_fprintf (es_stderr, "error writing to `%s': %s\n",
+ cookie->name, strerror(errno));
else
- fprintf (stderr, "error writing to file descriptor %d: %s\n",
- cookie->fd, strerror(errno));
+ es_fprintf (es_stderr, "error writing to file descriptor %d: %s\n",
+ cookie->fd, strerror(errno));
}
if (cookie->is_socket && cookie->fd != -1)
{
@@ -246,7 +251,7 @@ set_file_fd (const char *name, int fd)
if (name && !strcmp (name, "-"))
{
name = NULL;
- fd = fileno (stderr);
+ fd = es_fileno (es_stderr);
}
#ifndef HAVE_W32_SYSTEM
@@ -514,8 +519,10 @@ void
log_string (int level, const char *string)
{
/* We need to provide a dummy arg_ptr. volatile is needed to
- suppress compiler warnings. */
- volatile va_list dummy_arg_ptr;
+ suppress compiler warnings. The static is required for gcc 4.4
+ because it seems that it detects that a volatile automatic
+ variable is not any good if not initialized. */
+ static volatile va_list dummy_arg_ptr;
do_logv (level, 1, string, dummy_arg_ptr);
}
@@ -597,7 +604,7 @@ log_printf (const char *fmt, ...)
void
log_flush (void)
{
- volatile va_list dummy_arg_ptr;
+ static volatile va_list dummy_arg_ptr;
do_logv (JNLIB_LOG_CONT, 1, NULL, dummy_arg_ptr);
}
diff --git a/common/pka.c b/common/pka.c
index 4f0232324..751ccf7c2 100644
--- a/common/pka.c
+++ b/common/pka.c
@@ -274,6 +274,8 @@ get_pka_info (const char *address, unsigned char *fpr)
char *
get_pka_info (const char *address, unsigned char *fpr)
{
+ (void)address;
+ (void)fpr;
return NULL;
}
#endif /* !USE_DNS_PKA */
diff --git a/common/signal.c b/common/signal.c
index 2147dacab..422f6af3a 100644
--- a/common/signal.c
+++ b/common/signal.c
@@ -170,38 +170,13 @@ gnupg_init_signals (int mode, void (*fast_cleanup)(void))
#endif
}
-void
-gnupg_pause_on_sigusr (int which)
-{
-#ifndef HAVE_DOSISH_SYSTEM
-# ifdef HAVE_SIGPROCMASK
- sigset_t mask, oldmask;
-
- assert (which == 1);
- sigemptyset( &mask );
- sigaddset( &mask, SIGUSR1 );
-
- sigprocmask( SIG_BLOCK, &mask, &oldmask );
- while (!caught_sigusr1)
- sigsuspend (&oldmask);
- caught_sigusr1 = 0;
- sigprocmask (SIG_UNBLOCK, &mask, NULL);
-# else
- assert (which == 1);
- sighold (SIGUSR1);
- while (!caught_sigusr1)
- sigpause(SIGUSR1);
- caught_sigusr1 = 0;
- sigrelease(SIGUSR1);
-# endif /*!HAVE_SIGPROCMASK*/
-#endif
-}
-
static void
-do_block( int block )
+do_block (int block)
{
-#ifndef HAVE_DOSISH_SYSTEM
+#ifdef HAVE_DOSISH_SYSTEM
+ (void)block;
+#else /*!HAVE_DOSISH_SYSTEM*/
static int is_blocked;
#ifdef HAVE_SIGPROCMASK
static sigset_t oldmask;
@@ -247,7 +222,7 @@ do_block( int block )
is_blocked = 0;
}
#endif /*!HAVE_SIGPROCMASK*/
-#endif /*HAVE_DOSISH_SYSTEM*/
+#endif /*!HAVE_DOSISH_SYSTEM*/
}
diff --git a/common/sysutils.c b/common/sysutils.c
index 822ceab61..7fb8b20c9 100644
--- a/common/sysutils.c
+++ b/common/sysutils.c
@@ -498,7 +498,7 @@ gnupg_allow_set_foregound_window (pid_t pid)
if (!pid)
log_info ("%s called with invalid pid %lu\n",
"gnupg_allow_set_foregound_window", (unsigned long)pid);
-#ifdef HAVE_W32_SYSTEM
+#if defined(HAVE_W32_SYSTEM) && !defined(HAVE_W32CE_SYSTEM)
else if (!AllowSetForegroundWindow ((pid_t)pid == (pid_t)(-1)?ASFW_ANY:pid))
log_info ("AllowSetForegroundWindow(%lu) failed: %s\n",
(unsigned long)pid, w32_strerror (-1));
diff --git a/common/t-sysutils.c b/common/t-sysutils.c
index 45d359e7b..9b19d88ce 100644
--- a/common/t-sysutils.c
+++ b/common/t-sysutils.c
@@ -24,6 +24,10 @@
#include "util.h"
#include "sysutils.h"
+#ifdef HAVE_W32CE_SYSTEM
+# define rewind(f) do { fseek (f, 0, SEEK_SET); clearerr (f); } while (0)
+#endif
+
#define pass() do { ; } while(0)
#define fail(a) do { fprintf (stderr, "%s:%d: test %d failed\n",\
__FILE__,__LINE__, (a)); \
diff --git a/common/util.h b/common/util.h
index 4c566bcae..615b776c5 100644
--- a/common/util.h
+++ b/common/util.h
@@ -141,7 +141,6 @@ gnupg_copy_time (gnupg_isotime_t d, const gnupg_isotime_t s)
/*-- signal.c --*/
void gnupg_init_signals (int mode, void (*fast_cleanup)(void));
-void gnupg_pause_on_sigusr (int which);
void gnupg_block_all_signals (void);
void gnupg_unblock_all_signals (void);
diff --git a/configure.ac b/configure.ac
index 982a5923e..4ef658223 100644
--- a/configure.ac
+++ b/configure.ac
@@ -484,7 +484,7 @@ GNUPG_CHECK_USTAR
# We need to compile and run a program on the build machine. A
# comment in libgpg-error says that the AC_PROG_CC_FOR_BUILD macro in
-# the AC archive is broken for autoconf 2.57. Given that tehre is no
+# the AC archive is broken for autoconf 2.57. Given that there is no
# newer version of that macro, we assume that it is also broken for
# autoconf 2.61 and thus we use a simple but usually sufficient
# approach.
diff --git a/g10/gpg.c b/g10/gpg.c
index e365a8b8d..f9262a55b 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -1940,7 +1940,7 @@ main (int argc, char **argv)
/* Make sure that our subsystems are ready. */
i18n_init();
- init_common_subsystems ();
+ init_common_subsystems (&argc, &argv);
/* Check that the libraries are suitable. Do it right here because the
option parsing may need services of the library. */
diff --git a/g10/gpgv.c b/g10/gpgv.c
index ba4885b9e..d6e49e368 100644
--- a/g10/gpgv.c
+++ b/g10/gpgv.c
@@ -148,7 +148,7 @@ main( int argc, char **argv )
/* Make sure that our subsystems are ready. */
i18n_init();
- init_common_subsystems ();
+ init_common_subsystems (&argc, &argv);
gnupg_init_signals (0, NULL);
diff --git a/g13/g13.c b/g13/g13.c
index 28dfa8d36..bafb65f53 100644
--- a/g13/g13.c
+++ b/g13/g13.c
@@ -359,7 +359,7 @@ main ( int argc, char **argv)
/* Make sure that our subsystems are ready. */
i18n_init ();
- init_common_subsystems ();
+ init_common_subsystems (&argc, &argv);
/* Libgcrypt requires us to register the threading model first.
Note that this will also do the pth_init. */
diff --git a/kbx/kbxutil.c b/kbx/kbxutil.c
index 592f7d467..d2a64386f 100644
--- a/kbx/kbxutil.c
+++ b/kbx/kbxutil.c
@@ -419,7 +419,7 @@ main( int argc, char **argv )
/* Make sure that our subsystems are ready. */
i18n_init ();
- init_common_subsystems ();
+ init_common_subsystems (&argc, &argv);
/* Check that the libraries are suitable. Do it here because
the option parsing may need services of the library. */
diff --git a/scd/scdaemon.c b/scd/scdaemon.c
index 9a5e01f31..e5d8ea911 100644
--- a/scd/scdaemon.c
+++ b/scd/scdaemon.c
@@ -406,7 +406,7 @@ main (int argc, char **argv )
/* Make sure that our subsystems are ready. */
i18n_init ();
- init_common_subsystems ();
+ init_common_subsystems (&argc, &argv);
/* Libgcrypt requires us to register the threading model first.
diff --git a/sm/gpgsm.c b/sm/gpgsm.c
index 8774f7c32..1ce3797d2 100644
--- a/sm/gpgsm.c
+++ b/sm/gpgsm.c
@@ -911,7 +911,7 @@ main ( int argc, char **argv)
/* Make sure that our subsystems are ready. */
i18n_init();
- init_common_subsystems ();
+ init_common_subsystems (&argc, &argv);
/* Check that the libraries are suitable. Do it here because the
option parse may need services of the library */
diff --git a/sm/server.c b/sm/server.c
index 85c061312..bdba6393e 100644
--- a/sm/server.c
+++ b/sm/server.c
@@ -1248,7 +1248,7 @@ gpgsm_server (certlist_t default_recplist)
/* We use a pipe based server so that we can work from scripts.
assuan_init_pipe_server will automagically detect when we are
- called with a socketpair and ignore FIELDES in this case. */
+ called with a socketpair and ignore FILEDES in this case. */
filedes[0] = assuan_fdopen (0);
filedes[1] = assuan_fdopen (1);
rc = assuan_new (&ctx);
diff --git a/tools/gpg-check-pattern.c b/tools/gpg-check-pattern.c
index 8d152631d..42a6c62f0 100644
--- a/tools/gpg-check-pattern.c
+++ b/tools/gpg-check-pattern.c
@@ -169,7 +169,7 @@ main (int argc, char **argv )
/* Make sure that our subsystems are ready. */
i18n_init ();
- init_common_subsystems ();
+ init_common_subsystems (&argc, &argv);
/* We need Libgcrypt for hashing. */
if (!gcry_check_version (NEED_LIBGCRYPT_VERSION) )
diff --git a/tools/gpg-connect-agent.c b/tools/gpg-connect-agent.c
index 86ef2a642..2bd5f8549 100644
--- a/tools/gpg-connect-agent.c
+++ b/tools/gpg-connect-agent.c
@@ -1158,7 +1158,7 @@ main (int argc, char **argv)
/* Make sure that our subsystems are ready. */
i18n_init();
- init_common_subsystems ();
+ init_common_subsystems (&argc, &argv);
assuan_set_gpg_err_source (0);
diff --git a/tools/gpgconf.c b/tools/gpgconf.c
index 76e44670a..31f88bb3d 100644
--- a/tools/gpgconf.c
+++ b/tools/gpgconf.c
@@ -152,7 +152,7 @@ main (int argc, char **argv)
/* Make sure that our subsystems are ready. */
i18n_init();
- init_common_subsystems ();
+ init_common_subsystems (&argc, &argv);
/* Parse the command line. */
pargs.argc = &argc;
diff --git a/tools/symcryptrun.c b/tools/symcryptrun.c
index 7eeff97a1..2ef682210 100644
--- a/tools/symcryptrun.c
+++ b/tools/symcryptrun.c
@@ -884,7 +884,7 @@ main (int argc, char **argv)
/* Make sure that our subsystems are ready. */
i18n_init();
- init_common_subsystems ();
+ init_common_subsystems (&argc, &argv);
opt.homedir = default_homedir ();