[svn] pinentry - r212 - in trunk: . pinentry secmem

svn author wk cvs at cvs.gnupg.org
Wed Dec 2 10:36:41 CET 2009


Author: wk
Date: 2009-12-02 10:36:40 +0100 (Wed, 02 Dec 2009)
New Revision: 212

Modified:
   trunk/ChangeLog
   trunk/pinentry/pinentry-curses.c
   trunk/pinentry/pinentry.h
   trunk/secmem/util.c
Log:
Two portability fixes by Wyllys Ingersoll.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-08-10 15:27:56 UTC (rev 211)
+++ trunk/ChangeLog	2009-12-02 09:36:40 UTC (rev 212)
@@ -1,3 +1,11 @@
+2009-12-02  Werner Koch  <wk at g10code.com>
+
+	* secmem/util.c: Re-indent function names.
+	(TEMP_FAILURE_RETRY): Remove because it is non-portable.
+	(xwrite): Open code the EINTR retry.
+	* pinentry/pinentry-curses.c (dialog_run): Replace '\e' by a
+	standard escape.  Reported by Wyllys Ingersoll.
+
 2009-08-10  Marcus Brinkmann  <marcus at g10code.de>
 
 	* pinentry/pinentry.c [!ENABLE_ENHANCED]: Remove option enhanced.

Modified: trunk/pinentry/pinentry-curses.c
===================================================================
--- trunk/pinentry/pinentry-curses.c	2009-08-10 15:27:56 UTC (rev 211)
+++ trunk/pinentry/pinentry-curses.c	2009-12-02 09:36:40 UTC (rev 212)
@@ -767,7 +767,7 @@
 	    }
 	  break;
   
-	case '\e':
+	case '\005':
 	  done = -2;
 	  break;
 

Modified: trunk/pinentry/pinentry.h
===================================================================
--- trunk/pinentry/pinentry.h	2009-08-10 15:27:56 UTC (rev 211)
+++ trunk/pinentry/pinentry.h	2009-12-02 09:36:40 UTC (rev 212)
@@ -107,7 +107,7 @@
   /* If this is not NULL, a passphrase quality indicator is shown.
      There will also be an inquiry back to the caller to get an
      indication of the quality for the passphrase entered so far.  The
-     string is used as a labe for the auality bar.  */
+     string is used as a label for the quality bar.  */
   char *quality_bar;
 
   /* The tooltip to be show for the qualitybar.  Malloced or NULL.  */

Modified: trunk/secmem/util.c
===================================================================
--- trunk/secmem/util.c	2009-08-10 15:27:56 UTC (rev 211)
+++ trunk/secmem/util.c	2009-12-02 09:36:40 UTC (rev 212)
@@ -32,37 +32,36 @@
 
 #include "util.h"
 
-#ifndef TEMP_FAILURE_RETRY
-#define TEMP_FAILURE_RETRY(expression) \
-  (__extension__							      \
-    ({ long int __result;						      \
-       do __result = (long int) (expression);				      \
-       while (__result == -1L && errno == EINTR);			      \
-       __result; }))
-#endif
-
 #ifndef HAVE_DOSISH_SYSTEM
 static int uid_set = 0;
 static uid_t real_uid, file_uid;
 #endif /*!HAVE_DOSISH_SYSTEM*/
 
-/* write DATA of size BYTES to FD, until all is written or an error occurs */
-ssize_t xwrite(int fd, const void *data, size_t bytes)
+/* Write DATA of size BYTES to FD, until all is written or an error
+   occurs.  */
+ssize_t 
+xwrite(int fd, const void *data, size_t bytes)
 {
   char *ptr;
   size_t todo;
   ssize_t written = 0;
 
   for (ptr = (char *)data, todo = bytes; todo; ptr += written, todo -= written)
-    if ((written = TEMP_FAILURE_RETRY(write(fd, ptr, todo))) < 0)
-      break;
+    {
+      do
+        written = write (fd, ptr, todo);
+      while (written == -1 && errno == EINTR);
+      if (written < 0)
+        break;
+    }
   return written;
 }
 
 #if 0
 extern int debug;
 
-int debugmsg(const char *fmt, ...)
+int 
+debugmsg(const char *fmt, ...)
 {
   va_list va;
   int ret;
@@ -81,7 +80,8 @@
 
 /* initialize uid variables */
 #ifndef HAVE_DOSISH_SYSTEM
-static void init_uids(void)
+static void 
+init_uids(void)
 {
   real_uid = getuid();
   file_uid = geteuid();
@@ -92,7 +92,8 @@
 
 #if 0 /* Not used. */
 /* lower privileges to the real user's */
-void lower_privs()
+void 
+lower_privs()
 {
   if (!uid_set)
     init_uids();
@@ -111,7 +112,8 @@
 
 #if 0 /* Not used. */
 /* raise privileges to the effective user's */
-void raise_privs()
+void 
+raise_privs()
 {
   assert(real_uid >= 0);	/* lower_privs() must be called before this */
 #ifdef HAVE_SETEUID
@@ -123,7 +125,8 @@
 #endif /* if 0 */
 
 /* drop all additional privileges */
-void drop_privs()
+void 
+drop_privs()
 {
 #ifndef HAVE_DOSISH_SYSTEM
   if (!uid_set)




More information about the Gnupg-commits mailing list