[svn] GnuPG - r5302 - in trunk: common g10 sm tools

svn author wk cvs at cvs.gnupg.org
Mon Mar 29 14:57:12 CEST 2010


Author: wk
Date: 2010-03-29 14:57:11 +0200 (Mon, 29 Mar 2010)
New Revision: 5302

Modified:
   trunk/common/ChangeLog
   trunk/common/init.c
   trunk/g10/ChangeLog
   trunk/g10/main.h
   trunk/g10/signal.c
   trunk/sm/gpgsm.c
   trunk/tools/ChangeLog
   trunk/tools/Makefile.am
   trunk/tools/gpg-connect-agent.c
   trunk/tools/gpgconf-comp.c
Log:
Minor cleanups


Modified: trunk/common/ChangeLog
===================================================================
--- trunk/common/ChangeLog	2010-03-26 18:11:30 UTC (rev 5301)
+++ trunk/common/ChangeLog	2010-03-29 12:57:11 UTC (rev 5302)
@@ -1,3 +1,12 @@
+2010-03-29  Werner Koch  <wk at g10code.com>
+
+	* init.c (sleep_on_exit): Change to 400ms.
+
+2010-03-25  Werner Koch  <wk at g10code.com>
+
+	* init.c (sleep_on_exit) [W32CE]: New.
+	(init_common_subsystems): Call it.
+
 2010-03-24  Werner Koch  <wk at g10code.com>
 
 	* stringhelp.c (change_slashes, compare_filenames): Replace

Modified: trunk/g10/ChangeLog
===================================================================
--- trunk/g10/ChangeLog	2010-03-26 18:11:30 UTC (rev 5301)
+++ trunk/g10/ChangeLog	2010-03-29 12:57:11 UTC (rev 5302)
@@ -1,3 +1,8 @@
+2010-03-26  Werner Koch  <wk at 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 at g10code.com>
 
 	* openfile.c (CMP_FILENAME): Depend on HAVE_DOSISH_SYSTEM instead

Modified: trunk/tools/ChangeLog
===================================================================
--- trunk/tools/ChangeLog	2010-03-26 18:11:30 UTC (rev 5301)
+++ trunk/tools/ChangeLog	2010-03-29 12:57:11 UTC (rev 5302)
@@ -1,3 +1,12 @@
+2010-03-25  Werner Koch  <wk at 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 at g10code.com>
 
 	* gpgconf-comp.c (my_dgettext):

Modified: trunk/common/init.c
===================================================================
--- trunk/common/init.c	2010-03-26 18:11:30 UTC (rev 5301)
+++ trunk/common/init.c	2010-03-29 12:57:11 UTC (rev 5302)
@@ -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 @@
   /* 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;

Modified: trunk/g10/main.h
===================================================================
--- trunk/g10/main.h	2010-03-26 18:11:30 UTC (rev 5301)
+++ trunk/g10/main.h	2010-03-29 12:57:11 UTC (rev 5302)
@@ -331,7 +331,6 @@
 
 /*-- signal.c --*/
 void init_signals(void);
-void pause_on_sigusr( int which );
 void block_all_signals(void);
 void unblock_all_signals(void);
 

Modified: trunk/g10/signal.c
===================================================================
--- trunk/g10/signal.c	2010-03-26 18:11:30 UTC (rev 5301)
+++ trunk/g10/signal.c	2010-03-29 12:57:11 UTC (rev 5302)
@@ -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 @@
 }
 
 
-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

Modified: trunk/sm/gpgsm.c
===================================================================
--- trunk/sm/gpgsm.c	2010-03-26 18:11:30 UTC (rev 5301)
+++ trunk/sm/gpgsm.c	2010-03-29 12:57:11 UTC (rev 5302)
@@ -1969,7 +1969,6 @@
 emergency_cleanup (void)
 {
   gcry_control (GCRYCTL_TERM_SECMEM );
-  gnupg_sleep (2);
 }
 
 

Modified: trunk/tools/Makefile.am
===================================================================
--- trunk/tools/Makefile.am	2010-03-26 18:11:30 UTC (rev 5301)
+++ trunk/tools/Makefile.am	2010-03-29 12:57:11 UTC (rev 5302)
@@ -56,6 +56,10 @@
 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 @@
 
 # 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

Modified: trunk/tools/gpg-connect-agent.c
===================================================================
--- trunk/tools/gpg-connect-agent.c	2010-03-26 18:11:30 UTC (rev 5301)
+++ trunk/tools/gpg-connect-agent.c	2010-03-29 12:57:11 UTC (rev 5302)
@@ -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.
  *

Modified: trunk/tools/gpgconf-comp.c
===================================================================
--- trunk/tools/gpgconf-comp.c	2010-03-26 18:11:30 UTC (rev 5301)
+++ trunk/tools/gpgconf-comp.c	2010-03-29 12:57:11 UTC (rev 5302)
@@ -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 @@
 	  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 @@
     {
       char *tail;
 
-      errno = 0;
+      gpg_err_set_errno (0);
       *new_value_nr = strtoul (new_value, &tail, 0);
 
       if (errno)
@@ -2239,7 +2241,7 @@
 	}
       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 @@
 	}
       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 @@
     {
       int saved_err = errno;
       fclose (src);
-      errno = saved_err;
+      gpg_err_set_errno (saved_err);
       return -1;
     }
 
@@ -2312,7 +2314,7 @@
       fclose (src);
       fclose (dst);
       unlink (dst_name);
-      errno = saved_errno;
+      gpg_err_set_errno (saved_errno);
       return -1;
     }
 
@@ -2360,8 +2362,8 @@
   /* 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 @@
   res = errno;
   if (!src_file)
     {
-      errno = res;
+      gpg_err_set_errno (res);
       return -1;
     }
 
@@ -2599,7 +2601,7 @@
       close (fd);
       if (dest_file)
 	fclose (dest_file);
-      errno = res;
+      gpg_err_set_errno (res);
       return -1;
     }
   close (fd);
@@ -2621,7 +2623,7 @@
     }
   if (dest_file)
     fclose (dest_file);
-  errno = res;
+  gpg_err_set_errno (res);
   return -1;
 }
 
@@ -2652,8 +2654,8 @@
 
   /* 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 @@
   res = errno;
   if (!src_file)
     {
-      errno = res;
+      gpg_err_set_errno (res);
       return -1;
     }
 
@@ -2897,7 +2899,7 @@
       close (fd);
       if (dest_file)
 	fclose (dest_file);
-      errno = res;
+      gpg_err_set_errno (res);
       return -1;
     }
   close (fd);
@@ -2919,7 +2921,7 @@
     }
   if (dest_file)
     fclose (dest_file);
-  errno = res;
+  gpg_err_set_errno (res);
   return -1;
 }
 
@@ -3017,7 +3019,7 @@
               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_error (0, 0,
 			    _("External verification of component %s failed"),
 			    gc_component[component].name);
-		  errno = EINVAL;
+		  gpg_err_set_errno (EINVAL);
 		}
 	    }
 
@@ -3236,6 +3238,7 @@
   /* 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 @@
       if (!strcmp (user, my_name))
         return 1; /* Found.  */
     }
+#endif /*HAVE_W32CE_SYSTEM*/
 #else /*!HAVE_W32_SYSTEM*/
   /* First check whether the user matches.  */
   if (*user)




More information about the Gnupg-commits mailing list