diff options
author | Werner Koch <wk@gnupg.org> | 2010-03-29 14:57:11 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2010-03-29 14:57:11 +0200 |
commit | 492f08ff68bd01a28c483af31635c3d9bea4ea5d (patch) | |
tree | 49d398997bb513077e44edfd1840183e73e4ed64 | |
parent | More changes for CE. gpgsm does now build and run a keylisting. (diff) | |
download | gnupg2-492f08ff68bd01a28c483af31635c3d9bea4ea5d.tar.xz gnupg2-492f08ff68bd01a28c483af31635c3d9bea4ea5d.zip |
Minor cleanups
-rw-r--r-- | common/ChangeLog | 9 | ||||
-rw-r--r-- | common/init.c | 8 | ||||
-rw-r--r-- | g10/ChangeLog | 5 | ||||
-rw-r--r-- | g10/main.h | 1 | ||||
-rw-r--r-- | g10/signal.c | 26 | ||||
-rw-r--r-- | sm/gpgsm.c | 1 | ||||
-rw-r--r-- | tools/ChangeLog | 9 | ||||
-rw-r--r-- | tools/Makefile.am | 6 | ||||
-rw-r--r-- | tools/gpg-connect-agent.c | 2 | ||||
-rw-r--r-- | tools/gpgconf-comp.c | 44 |
10 files changed, 61 insertions, 50 deletions
diff --git a/common/ChangeLog b/common/ChangeLog index cf71cb28e..2e61181e9 100644 --- a/common/ChangeLog +++ b/common/ChangeLog @@ -1,3 +1,12 @@ +2010-03-29 Werner Koch <wk@g10code.com> + + * init.c (sleep_on_exit): Change to 400ms. + +2010-03-25 Werner Koch <wk@g10code.com> + + * init.c (sleep_on_exit) [W32CE]: New. + (init_common_subsystems): Call it. + 2010-03-24 Werner Koch <wk@g10code.com> * stringhelp.c (change_slashes, compare_filenames): Replace diff --git a/common/init.c b/common/init.c index 9023c8db9..0904cf7b1 100644 --- a/common/init.c +++ b/common/init.c @@ -36,6 +36,13 @@ #ifdef HAVE_W32CE_SYSTEM #include <assuan.h> static void parse_std_file_handles (int *argcp, char ***argvp); +static void +sleep_on_exit (void) +{ + /* The sshd on CE swallows some of the command output. Sleeping a + while usually helps. */ + Sleep (400); +} #endif /*HAVE_W32CE_SYSTEM*/ @@ -77,6 +84,7 @@ init_common_subsystems (int *argcp, char ***argvp) /* Special hack for Windows CE: We extract some options from arg to setup the standard handles. */ #ifdef HAVE_W32CE_SYSTEM + atexit (sleep_on_exit); parse_std_file_handles (argcp, argvp); #else (void)argcp; diff --git a/g10/ChangeLog b/g10/ChangeLog index 87b62a04a..6def55468 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,8 @@ +2010-03-26 Werner Koch <wk@g10code.com> + + * signal.c (pause_on_sigusr): Remove. It was used in ancient gpg + version with shared memory IPC. Last caller removed on 2006-04-18. + 2010-03-24 Werner Koch <wk@g10code.com> * openfile.c (CMP_FILENAME): Depend on HAVE_DOSISH_SYSTEM instead diff --git a/g10/main.h b/g10/main.h index 8ce422f2c..781a49f38 100644 --- a/g10/main.h +++ b/g10/main.h @@ -331,7 +331,6 @@ PKT_plaintext *setup_plaintext_name(const char *filename,IOBUF iobuf); /*-- signal.c --*/ void init_signals(void); -void pause_on_sigusr( int which ); void block_all_signals(void); void unblock_all_signals(void); diff --git a/g10/signal.c b/g10/signal.c index c9e683f72..11ebc5208 100644 --- a/g10/signal.c +++ b/g10/signal.c @@ -36,7 +36,6 @@ #ifdef HAVE_DOSISH_SYSTEM void init_signals(void) {} -void pause_on_sigusr(int which) {} #else static volatile int caught_fatal_sig = 0; static volatile int caught_sigusr1 = 0; @@ -133,31 +132,6 @@ init_signals() } -void -pause_on_sigusr( int which ) -{ -#if defined(HAVE_SIGPROCMASK) && defined(HAVE_SIGSET_T) - 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; - sigrelse(SIGUSR1); -#endif /*! HAVE_SIGPROCMASK && HAVE_SIGSET_T */ -} - /* Disabled - see comment in tdbio.c:tdbio_begin_transaction() */ #if 0 static void diff --git a/sm/gpgsm.c b/sm/gpgsm.c index cf4eafa25..1212bc9b7 100644 --- a/sm/gpgsm.c +++ b/sm/gpgsm.c @@ -1969,7 +1969,6 @@ static void emergency_cleanup (void) { gcry_control (GCRYCTL_TERM_SECMEM ); - gnupg_sleep (2); } diff --git a/tools/ChangeLog b/tools/ChangeLog index b9e486b2b..52a16a238 100644 --- a/tools/ChangeLog +++ b/tools/ChangeLog @@ -1,3 +1,12 @@ +2010-03-25 Werner Koch <wk@g10code.com> + + * Makefile.am (opt_libassuan_libs) [W32CE]: New. + (gpgconf_LDADD): Use it. + + * gpgconf-comp.c: Include signal.h only if available. Use + gpg_err_set_errno. + (key_matches_user_or_group) [W32CE]: Do not match any user. + 2010-03-15 Werner Koch <wk@g10code.com> * gpgconf-comp.c (my_dgettext): diff --git a/tools/Makefile.am b/tools/Makefile.am index ea066e67b..a610e6282 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -56,6 +56,10 @@ noinst_PROGRAMS = clean-sat mk-tdata make-dns-cert gpgsplit common_libs = $(libcommon) ../gl/libgnu.a pwquery_libs = ../common/libsimple-pwquery.a +if HAVE_W32CE_SYSTEM +opt_libassuan_libs = $(LIBASSUAN_LIBS) +endif + gpgsplit_LDADD = $(common_libs) \ $(LIBGCRYPT_LIBS) $(GPG_ERROR_LIBS) \ $(ZLIBS) $(LIBINTL) $(LIBICONV) @@ -64,7 +68,7 @@ gpgconf_SOURCES = gpgconf.c gpgconf.h gpgconf-comp.c no-libgcrypt.c # common sucks in gpg-error, will they, nil they (some compilers # do not eliminate the supposed-to-be-unused-inline-functions). -gpgconf_LDADD = $(common_libs) \ +gpgconf_LDADD = $(common_libs) $(opt_libassuan_libs) \ $(LIBINTL) $(GPG_ERROR_LIBS) $(LIBICONV) $(W32SOCKLIBS) gpgparsemail_SOURCES = gpgparsemail.c rfc822parse.c rfc822parse.h diff --git a/tools/gpg-connect-agent.c b/tools/gpg-connect-agent.c index 2bd5f8549..ae46caea8 100644 --- a/tools/gpg-connect-agent.c +++ b/tools/gpg-connect-agent.c @@ -1,5 +1,5 @@ /* gpg-connect-agent.c - Tool to connect to the agent. - * Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc. + * Copyright (C) 2005, 2007, 2008, 2010 Free Software Foundation, Inc. * * This file is part of GnuPG. * diff --git a/tools/gpgconf-comp.c b/tools/gpgconf-comp.c index 866646d0d..4fe84cf27 100644 --- a/tools/gpgconf-comp.c +++ b/tools/gpgconf-comp.c @@ -1,5 +1,5 @@ /* gpgconf-comp.c - Configuration utility for GnuPG. - * Copyright (C) 2004, 2007, 2008, 2009 Free Software Foundation, Inc. + * Copyright (C) 2004, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -30,7 +30,9 @@ #include <errno.h> #include <time.h> #include <stdarg.h> -#include <signal.h> +#ifdef HAVE_SIGNAL_H +# include <signal.h> +#endif #include <ctype.h> #ifdef HAVE_W32_SYSTEM # define WIN32_LEAN_AND_MEAN 1 @@ -1869,7 +1871,7 @@ retrieve_options_from_program (gc_component_t component, gc_backend_t backend) if (end) *(end++) = '\0'; - errno = 0; + gpg_err_set_errno (0); flags = strtoul (linep, &tail, 0); if (errno) gc_error (1, errno, "malformed flags in option %s from %s", @@ -2185,7 +2187,7 @@ option_check_validity (gc_option_t *option, unsigned long flags, { char *tail; - errno = 0; + gpg_err_set_errno (0); *new_value_nr = strtoul (new_value, &tail, 0); if (errno) @@ -2239,7 +2241,7 @@ option_check_validity (gc_option_t *option, unsigned long flags, } else if (gc_arg_type[option->arg_type].fallback == GC_ARG_TYPE_INT32) { - errno = 0; + gpg_err_set_errno (0); (void) strtol (arg, &arg, 0); if (errno) @@ -2252,7 +2254,7 @@ option_check_validity (gc_option_t *option, unsigned long flags, } else if (gc_arg_type[option->arg_type].fallback == GC_ARG_TYPE_INT32) { - errno = 0; + gpg_err_set_errno (0); (void) strtoul (arg, &arg, 0); if (errno) @@ -2289,7 +2291,7 @@ copy_file (const char *src_name, const char *dst_name) { int saved_err = errno; fclose (src); - errno = saved_err; + gpg_err_set_errno (saved_err); return -1; } @@ -2312,7 +2314,7 @@ copy_file (const char *src_name, const char *dst_name) fclose (src); fclose (dst); unlink (dst_name); - errno = saved_errno; + gpg_err_set_errno (saved_errno); return -1; } @@ -2360,8 +2362,8 @@ change_options_file (gc_component_t component, gc_backend_t backend, /* Note that get_config_filename() calls percent_deescape(), so we call this before processing the arguments. */ dest_filename = xstrdup (get_config_filename (component, backend)); - src_filename = xasprintf ("%s.gpgconf.%i.new", dest_filename, getpid ()); - orig_filename = xasprintf ("%s.gpgconf.%i.bak", dest_filename, getpid ()); + src_filename = xasprintf ("%s.gpgconf.%i.new", dest_filename, (int)getpid ()); + orig_filename = xasprintf ("%s.gpgconf.%i.bak", dest_filename,(int)getpid ()); arg = option->new_value; if (arg && arg[0] == '\0') @@ -2412,7 +2414,7 @@ change_options_file (gc_component_t component, gc_backend_t backend, res = errno; if (!src_file) { - errno = res; + gpg_err_set_errno (res); return -1; } @@ -2599,7 +2601,7 @@ change_options_file (gc_component_t component, gc_backend_t backend, close (fd); if (dest_file) fclose (dest_file); - errno = res; + gpg_err_set_errno (res); return -1; } close (fd); @@ -2621,7 +2623,7 @@ change_options_file (gc_component_t component, gc_backend_t backend, } if (dest_file) fclose (dest_file); - errno = res; + gpg_err_set_errno (res); return -1; } @@ -2652,8 +2654,8 @@ change_options_program (gc_component_t component, gc_backend_t backend, /* FIXME. Throughout the function, do better error reporting. */ dest_filename = xstrdup (get_config_filename (component, backend)); - src_filename = xasprintf ("%s.gpgconf.%i.new", dest_filename, getpid ()); - orig_filename = xasprintf ("%s.gpgconf.%i.bak", dest_filename, getpid ()); + src_filename = xasprintf ("%s.gpgconf.%i.new", dest_filename, (int)getpid ()); + orig_filename = xasprintf ("%s.gpgconf.%i.bak", dest_filename,(int)getpid ()); #ifdef HAVE_W32_SYSTEM res = copy_file (dest_filename, orig_filename); @@ -2682,7 +2684,7 @@ change_options_program (gc_component_t component, gc_backend_t backend, res = errno; if (!src_file) { - errno = res; + gpg_err_set_errno (res); return -1; } @@ -2897,7 +2899,7 @@ change_options_program (gc_component_t component, gc_backend_t backend, close (fd); if (dest_file) fclose (dest_file); - errno = res; + gpg_err_set_errno (res); return -1; } close (fd); @@ -2919,7 +2921,7 @@ change_options_program (gc_component_t component, gc_backend_t backend, } if (dest_file) fclose (dest_file); - errno = res; + gpg_err_set_errno (res); return -1; } @@ -3017,7 +3019,7 @@ gc_component_change_options (int component, FILE *in, FILE *out) if (end) *(end++) = '\0'; - errno = 0; + gpg_err_set_errno (0); flags = strtoul (linep, &tail, 0); if (errno) gc_error (1, errno, "malformed flags in option %s", line); @@ -3087,7 +3089,7 @@ gc_component_change_options (int component, FILE *in, FILE *out) gc_error (0, 0, _("External verification of component %s failed"), gc_component[component].name); - errno = EINVAL; + gpg_err_set_errno (EINVAL); } } @@ -3236,6 +3238,7 @@ key_matches_user_or_group (char *user) /* Under Windows we don't support groups. */ if (group && *group) gc_error (0, 0, _("Note that group specifications are ignored\n")); +#ifndef HAVE_W32CE_SYSTEM if (*user) { static char *my_name; @@ -3255,6 +3258,7 @@ key_matches_user_or_group (char *user) if (!strcmp (user, my_name)) return 1; /* Found. */ } +#endif /*HAVE_W32CE_SYSTEM*/ #else /*!HAVE_W32_SYSTEM*/ /* First check whether the user matches. */ if (*user) |