[git] GPG-ERROR - branch, master, updated. libgpg-error-1.21-20-g4354720

by Werner Koch cvs at cvs.gnupg.org
Tue Apr 5 15:45:10 CEST 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Error codes used by GnuPG et al.".

The branch, master has been updated
       via  4354720ab3631dfd2811d881566b10a72c8f2165 (commit)
       via  5d1adaa5fd12f65f49abeb99e5ae7226ec27ba0e (commit)
       via  de0618d5c64e02b9b3a568fc859d9edcb4ab35ba (commit)
      from  b7a06ad63371316bad5da6b981894ef07cd8b7da (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 4354720ab3631dfd2811d881566b10a72c8f2165
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Apr 5 15:43:26 2016 +0200

    estream,w32: Temporary fix for gpgrt_poll.
    
    * src/estream.c (_gpgrt_poll) [W32]: Do not use FD_ISSET.
    --
    
    gpgrt_poll return an error on Windows anyway and thus it does not make
    sense to use a possible undefined macro here.
    
    Reported-by: Andre Heinecke
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/estream.c b/src/estream.c
index a593acd..499cc75 100644
--- a/src/estream.c
+++ b/src/estream.c
@@ -4832,6 +4832,9 @@ _gpgrt_poll (gpgrt_poll_t *fds, unsigned int nfds, int timeout)
           item->got_hup = 1;
           any = 1;
         }
+#ifndef _WIN32
+      /* NB.: We can't use FD_ISSET under windows - but we don't have
+       * support for it anyway.  */
       if (item->want_read && FD_ISSET (fd, &readfds))
         {
           item->got_read = 1;
@@ -4847,6 +4850,7 @@ _gpgrt_poll (gpgrt_poll_t *fds, unsigned int nfds, int timeout)
           item->got_oob = 1;
           any = 1;
         }
+#endif /*!_WIN32*/
 
       if (any)
         count++;

commit 5d1adaa5fd12f65f49abeb99e5ae7226ec27ba0e
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Mar 29 18:45:15 2016 +0200

    estream: Prepare for new mode flag "sysopen".
    
    * src/estream.c (parse_mode): Add arg "sysopen".  Adjust all callers.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/estream.c b/src/estream.c
index 5721d8c..a593acd 100644
--- a/src/estream.c
+++ b/src/estream.c
@@ -1590,7 +1590,7 @@ static gpgrt_cookie_io_functions_t estream_functions_fp =
  * Implementation of file name based I/O.
  *
  * Note that only a create function is required because the other
- * operationsares handled by file descriptor based I/O.
+ * operations ares handled by file descriptor based I/O.
  */
 
 /* Create function for objects identified by a file name.  */
@@ -1669,18 +1669,26 @@ func_file_create (void **cookie, int *filedes,
  *    The object is opened in non-blocking mode.  This is the same as
  *    calling gpgrt_set_nonblock on the file.
  *
+ * sysopen
+ *
+ *    The object is opened in sysmode.  On POSIX this is a NOP but
+ *    under Windows the direct W32 API functions (HANDLE) are used
+ *    instead of their libc counterparts (fd).
+ *
  * Note: R_CMODE is optional because is only required by functions
  * which are able to creat a file.
  */
 static int
 parse_mode (const char *modestr,
-            unsigned int *modeflags, int *samethread,
+            unsigned int *modeflags, int *samethread, int *sysopen,
             unsigned int *r_cmode)
 {
   unsigned int omode, oflags, cmode;
   int got_cmode = 0;
 
   *samethread = 0;
+  if (sysopen)
+    *sysopen = 0;
 
   switch (*modestr)
     {
@@ -1774,6 +1782,17 @@ parse_mode (const char *modestr,
             }
           oflags |= O_NONBLOCK;
         }
+      else if (!strncmp (modestr, "sysopen", 7))
+        {
+          modestr += 8;
+          if (*modestr && !strchr (" \t,", *modestr))
+            {
+              _set_errno (EINVAL);
+              return -1;
+            }
+          if (sysopen)
+            *sysopen = 1;
+        }
     }
   if (!got_cmode)
     cmode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
@@ -2994,7 +3013,7 @@ _gpgrt_fopen (const char *_GPGRT__RESTRICT path,
               const char *_GPGRT__RESTRICT mode)
 {
   unsigned int modeflags, cmode;
-  int samethread, create_called;
+  int samethread, sysopen, create_called;
   estream_t stream;
   void *cookie;
   int err;
@@ -3005,7 +3024,7 @@ _gpgrt_fopen (const char *_GPGRT__RESTRICT path,
   cookie = NULL;
   create_called = 0;
 
-  err = parse_mode (mode, &modeflags, &samethread, &cmode);
+  err = parse_mode (mode, &modeflags, &samethread, &sysopen, &cmode);
   if (err)
     goto out;
 
@@ -3015,7 +3034,6 @@ _gpgrt_fopen (const char *_GPGRT__RESTRICT path,
 
   syshd.type = ES_SYSHD_FD;
   syshd.u.fd = fd;
-
   create_called = 1;
   err = es_create (&stream, cookie, &syshd, estream_functions_fd, modeflags,
                    samethread, 0);
@@ -3063,7 +3081,7 @@ _gpgrt_mopen (void *_GPGRT__RESTRICT data, size_t data_n, size_t data_len,
   int err;
   es_syshd_t syshd;
 
-  err = parse_mode (mode, &modeflags, &samethread, NULL);
+  err = parse_mode (mode, &modeflags, &samethread, NULL, NULL);
   if (err)
     goto out;
 
@@ -3099,7 +3117,7 @@ _gpgrt_fopenmem (size_t memlimit, const char *_GPGRT__RESTRICT mode)
 
   /* Memory streams are always read/write.  We use MODE only to get
      the append flag.  */
-  if (parse_mode (mode, &modeflags, &samethread, NULL))
+  if (parse_mode (mode, &modeflags, &samethread, NULL, NULL))
     return NULL;
   modeflags |= O_RDWR;
 
@@ -3170,7 +3188,7 @@ _gpgrt_fopencookie (void *_GPGRT__RESTRICT cookie,
   stream = NULL;
   modeflags = 0;
 
-  err = parse_mode (mode, &modeflags, &samethread, NULL);
+  err = parse_mode (mode, &modeflags, &samethread, NULL, NULL);
   if (err)
     goto out;
 
@@ -3190,7 +3208,7 @@ static estream_t
 do_fdopen (int filedes, const char *mode, int no_close, int with_locked_list)
 {
   unsigned int modeflags;
-  int samethread, create_called;
+  int samethread, sysopen, create_called;
   estream_t stream;
   void *cookie;
   int err;
@@ -3200,9 +3218,16 @@ do_fdopen (int filedes, const char *mode, int no_close, int with_locked_list)
   cookie = NULL;
   create_called = 0;
 
-  err = parse_mode (mode, &modeflags, &samethread, NULL);
+  err = parse_mode (mode, &modeflags, &samethread, &sysopen, NULL);
   if (err)
     goto out;
+  if (sysopen)
+    {
+      /* Not allowed for fdopen.  */
+      _set_errno (EINVAL);
+      err = -1;
+      goto out;
+    }
 
   err = func_fd_create (&cookie, filedes, modeflags, no_close);
   if (err)
@@ -3247,7 +3272,7 @@ static estream_t
 do_fpopen (FILE *fp, const char *mode, int no_close, int with_locked_list)
 {
   unsigned int modeflags, cmode;
-  int samethread, create_called;
+  int samethread, sysopen, create_called;
   estream_t stream;
   void *cookie;
   int err;
@@ -3257,9 +3282,16 @@ do_fpopen (FILE *fp, const char *mode, int no_close, int with_locked_list)
   cookie = NULL;
   create_called = 0;
 
-  err = parse_mode (mode, &modeflags, &samethread, &cmode);
+  err = parse_mode (mode, &modeflags, &samethread, &sysopen, &cmode);
   if (err)
     goto out;
+  if (sysopen)
+    {
+      /* Not allowed for fpopen.  */
+      _set_errno (EINVAL);
+      err = -1;
+      goto out;
+    }
 
   if (fp)
     fflush (fp);
@@ -3319,7 +3351,8 @@ do_w32open (HANDLE hd, const char *mode,
   int err;
   es_syshd_t syshd;
 
-  err = parse_mode (mode, &modeflags, &samethread, &cmode);
+  /* For obvious reasons we ignore sysmode here.  */
+  err = parse_mode (mode, &modeflags, &samethread, NULL, &cmode);
   if (err)
     goto leave;
 
@@ -3497,7 +3530,7 @@ _gpgrt_freopen (const char *_GPGRT__RESTRICT path,
 
       es_deinitialize (stream);
 
-      err = parse_mode (mode, &modeflags, &dummy, &cmode);
+      err = parse_mode (mode, &modeflags, &dummy, NULL, &cmode);
       if (err)
 	goto leave;
       (void)dummy;

commit de0618d5c64e02b9b3a568fc859d9edcb4ab35ba
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Mar 29 18:48:37 2016 +0200

    estream: Use simpler names for static functions.
    
    * src/estream.c: Replace all es_func_* to just func_*.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/estream.c b/src/estream.c
index 737f9a5..5721d8c 100644
--- a/src/estream.c
+++ b/src/estream.c
@@ -667,7 +667,7 @@ func_mem_create (void *_GPGRT__RESTRICT *_GPGRT__RESTRICT cookie,
  * Read function for memory objects.
  */
 static gpgrt_ssize_t
-es_func_mem_read (void *cookie, void *buffer, size_t size)
+func_mem_read (void *cookie, void *buffer, size_t size)
 {
   estream_cookie_mem_t mem_cookie = cookie;
   gpgrt_ssize_t ret;
@@ -693,7 +693,7 @@ es_func_mem_read (void *cookie, void *buffer, size_t size)
  * Write function for memory objects.
  */
 static gpgrt_ssize_t
-es_func_mem_write (void *cookie, const void *buffer, size_t size)
+func_mem_write (void *cookie, const void *buffer, size_t size)
 {
   estream_cookie_mem_t mem_cookie = cookie;
   gpgrt_ssize_t ret;
@@ -781,7 +781,7 @@ es_func_mem_write (void *cookie, const void *buffer, size_t size)
  * Seek function for memory objects.
  */
 static int
-es_func_mem_seek (void *cookie, gpgrt_off_t *offset, int whence)
+func_mem_seek (void *cookie, gpgrt_off_t *offset, int whence)
 {
   estream_cookie_mem_t mem_cookie = cookie;
   gpgrt_off_t pos_new;
@@ -859,7 +859,7 @@ es_func_mem_seek (void *cookie, gpgrt_off_t *offset, int whence)
  * The IOCTL function for memory objects.
  */
 static int
-es_func_mem_ioctl (void *cookie, int cmd, void *ptr, size_t *len)
+func_mem_ioctl (void *cookie, int cmd, void *ptr, size_t *len)
 {
   estream_cookie_mem_t mem_cookie = cookie;
   int ret;
@@ -889,7 +889,7 @@ es_func_mem_ioctl (void *cookie, int cmd, void *ptr, size_t *len)
  * The destroy function for memory objects.
  */
 static int
-es_func_mem_destroy (void *cookie)
+func_mem_destroy (void *cookie)
 {
   estream_cookie_mem_t mem_cookie = cookie;
 
@@ -906,10 +906,10 @@ es_func_mem_destroy (void *cookie)
  */
 static gpgrt_cookie_io_functions_t estream_functions_mem =
   {
-    es_func_mem_read,
-    es_func_mem_write,
-    es_func_mem_seek,
-    es_func_mem_destroy
+    func_mem_read,
+    func_mem_write,
+    func_mem_seek,
+    func_mem_destroy
   };
 
 
@@ -961,7 +961,7 @@ func_fd_create (void **cookie, int fd, unsigned int modeflags, int no_close)
  * Read function for fd objects.
  */
 static gpgrt_ssize_t
-es_func_fd_read (void *cookie, void *buffer, size_t size)
+func_fd_read (void *cookie, void *buffer, size_t size)
 
 {
   estream_cookie_fd_t file_cookie = cookie;
@@ -995,7 +995,7 @@ es_func_fd_read (void *cookie, void *buffer, size_t size)
  * Write function for fd objects.
  */
 static gpgrt_ssize_t
-es_func_fd_write (void *cookie, const void *buffer, size_t size)
+func_fd_write (void *cookie, const void *buffer, size_t size)
 {
   estream_cookie_fd_t file_cookie = cookie;
   gpgrt_ssize_t bytes_written;
@@ -1028,7 +1028,7 @@ es_func_fd_write (void *cookie, const void *buffer, size_t size)
  * Seek function for fd objects.
  */
 static int
-es_func_fd_seek (void *cookie, gpgrt_off_t *offset, int whence)
+func_fd_seek (void *cookie, gpgrt_off_t *offset, int whence)
 {
   estream_cookie_fd_t file_cookie = cookie;
   gpgrt_off_t offset_new;
@@ -1063,7 +1063,7 @@ es_func_fd_seek (void *cookie, gpgrt_off_t *offset, int whence)
  * The IOCTL function for fd objects.
  */
 static int
-es_func_fd_ioctl (void *cookie, int cmd, void *ptr, size_t *len)
+func_fd_ioctl (void *cookie, int cmd, void *ptr, size_t *len)
 {
   estream_cookie_fd_t fd_cookie = cookie;
   int ret;
@@ -1106,7 +1106,7 @@ es_func_fd_ioctl (void *cookie, int cmd, void *ptr, size_t *len)
  * The destroy function for fd objects.
  */
 static int
-es_func_fd_destroy (void *cookie)
+func_fd_destroy (void *cookie)
 {
   estream_cookie_fd_t fd_cookie = cookie;
   int err;
@@ -1131,10 +1131,10 @@ es_func_fd_destroy (void *cookie)
  */
 static gpgrt_cookie_io_functions_t estream_functions_fd =
   {
-    es_func_fd_read,
-    es_func_fd_write,
-    es_func_fd_seek,
-    es_func_fd_destroy
+    func_fd_read,
+    func_fd_write,
+    func_fd_seek,
+    func_fd_destroy
   };
 
 
@@ -1157,7 +1157,7 @@ typedef struct estream_cookie_w32
  * Create function for w32 handle objects.
  */
 static int
-es_func_w32_create (void **cookie, HANDLE hd,
+func_w32_create (void **cookie, HANDLE hd,
                     unsigned int modeflags, int no_close)
 {
   estream_cookie_w32_t w32_cookie;
@@ -1186,7 +1186,7 @@ es_func_w32_create (void **cookie, HANDLE hd,
  * Read function for W32 handle objects.
  */
 static gpgrt_ssize_t
-es_func_w32_read (void *cookie, void *buffer, size_t size)
+func_w32_read (void *cookie, void *buffer, size_t size)
 {
   estream_cookie_w32_t w32_cookie = cookie;
   gpgrt_ssize_t bytes_read;
@@ -1233,7 +1233,7 @@ es_func_w32_read (void *cookie, void *buffer, size_t size)
  * Write function for W32 handle objects.
  */
 static gpgrt_ssize_t
-es_func_w32_write (void *cookie, const void *buffer, size_t size)
+func_w32_write (void *cookie, const void *buffer, size_t size)
 {
   estream_cookie_w32_t w32_cookie = cookie;
   gpgrt_ssize_t bytes_written;
@@ -1274,7 +1274,7 @@ es_func_w32_write (void *cookie, const void *buffer, size_t size)
  * Seek function for W32 handle objects.
  */
 static int
-es_func_w32_seek (void *cookie, gpgrt_off_t *offset, int whence)
+func_w32_seek (void *cookie, gpgrt_off_t *offset, int whence)
 {
   estream_cookie_w32_t w32_cookie = cookie;
   DWORD method;
@@ -1331,7 +1331,7 @@ es_func_w32_seek (void *cookie, gpgrt_off_t *offset, int whence)
  * Destroy function for W32 handle objects.
  */
 static int
-es_func_w32_destroy (void *cookie)
+func_w32_destroy (void *cookie)
 {
   estream_cookie_w32_t w32_cookie = cookie;
   int err;
@@ -1366,10 +1366,10 @@ es_func_w32_destroy (void *cookie)
  */
 static gpgrt_cookie_io_functions_t estream_functions_w32 =
   {
-    es_func_w32_read,
-    es_func_w32_write,
-    es_func_w32_seek,
-    es_func_w32_destroy
+    func_w32_read,
+    func_w32_write,
+    func_w32_seek,
+    func_w32_destroy
   };
 #endif /*HAVE_W32_SYSTEM*/
 
@@ -1424,7 +1424,7 @@ func_fp_create (void **cookie, FILE *fp,
  * Read function for stdio based objects.
  */
 static gpgrt_ssize_t
-es_func_fp_read (void *cookie, void *buffer, size_t size)
+func_fp_read (void *cookie, void *buffer, size_t size)
 
 {
   estream_cookie_fp_t file_cookie = cookie;
@@ -1453,7 +1453,7 @@ es_func_fp_read (void *cookie, void *buffer, size_t size)
  * Write function for stdio bases objects.
  */
 static gpgrt_ssize_t
-es_func_fp_write (void *cookie, const void *buffer, size_t size)
+func_fp_write (void *cookie, const void *buffer, size_t size)
 {
   estream_cookie_fp_t file_cookie = cookie;
   size_t bytes_written;
@@ -1505,7 +1505,7 @@ es_func_fp_write (void *cookie, const void *buffer, size_t size)
  * Seek function for stdio based objects.
  */
 static int
-es_func_fp_seek (void *cookie, gpgrt_off_t *offset, int whence)
+func_fp_seek (void *cookie, gpgrt_off_t *offset, int whence)
 {
   estream_cookie_fp_t file_cookie = cookie;
   long int offset_new;
@@ -1545,7 +1545,7 @@ es_func_fp_seek (void *cookie, gpgrt_off_t *offset, int whence)
  * Destroy function for stdio based objects.
  */
 static int
-es_func_fp_destroy (void *cookie)
+func_fp_destroy (void *cookie)
 {
   estream_cookie_fp_t fp_cookie = cookie;
   int err;
@@ -1577,10 +1577,10 @@ es_func_fp_destroy (void *cookie)
  */
 static gpgrt_cookie_io_functions_t estream_functions_fp =
   {
-    es_func_fp_read,
-    es_func_fp_write,
-    es_func_fp_seek,
-    es_func_fp_destroy
+    func_fp_read,
+    func_fp_write,
+    func_fp_seek,
+    func_fp_destroy
   };
 
 
@@ -2856,7 +2856,7 @@ doreadline (estream_t _GPGRT__RESTRICT stream, size_t max_length,
   if (line_stream)
     do_close (line_stream, 0);
   else if (line_stream_cookie)
-    es_func_mem_destroy (line_stream_cookie);
+    func_mem_destroy (line_stream_cookie);
 
   if (err)
     {
@@ -3115,7 +3115,7 @@ _gpgrt_fopenmem (size_t memlimit, const char *_GPGRT__RESTRICT mode)
     (*estream_functions_mem.func_close) (cookie);
 
   if (stream)
-    stream->intern->func_ioctl = es_func_mem_ioctl;
+    stream->intern->func_ioctl = func_mem_ioctl;
 
   return stream;
 }
@@ -3216,9 +3216,9 @@ do_fdopen (int filedes, const char *mode, int no_close, int with_locked_list)
 
   if (!err && stream)
     {
-      stream->intern->func_ioctl = es_func_fd_ioctl;
+      stream->intern->func_ioctl = func_fd_ioctl;
       if ((modeflags & O_NONBLOCK))
-        err = es_func_fd_ioctl (cookie, COOKIE_IOCTL_NONBLOCK, "", NULL);
+        err = func_fd_ioctl (cookie, COOKIE_IOCTL_NONBLOCK, "", NULL);
     }
 
  out:
@@ -3323,7 +3323,7 @@ do_w32open (HANDLE hd, const char *mode,
   if (err)
     goto leave;
 
-  err = es_func_w32_create (&cookie, hd, modeflags, no_close);
+  err = func_w32_create (&cookie, hd, modeflags, no_close);
   if (err)
     goto leave;
 
@@ -3517,7 +3517,7 @@ _gpgrt_freopen (const char *_GPGRT__RESTRICT path,
       if (err)
 	{
 	  if (create_called)
-	    es_func_fd_destroy (cookie);
+	    func_fd_destroy (cookie);
 
 	  do_close (stream, 0);
 	  stream = NULL;
@@ -4510,7 +4510,7 @@ _gpgrt_tmpfile (void)
   if (err)
     {
       if (create_called)
-	es_func_fd_destroy (cookie);
+	func_fd_destroy (cookie);
       else if (fd != -1)
 	close (fd);
       stream = NULL;
@@ -4555,14 +4555,14 @@ _gpgrt_set_binary (estream_t stream)
     {
       stream->intern->modeflags |= O_BINARY;
 #ifdef HAVE_DOSISH_SYSTEM
-      if (stream->intern->func_read == es_func_fd_read)
+      if (stream->intern->func_read == func_fd_read)
         {
           estream_cookie_fd_t fd_cookie = stream->intern->cookie;
 
           if (!IS_INVALID_FD (fd_cookie->fd))
             setmode (fd_cookie->fd, O_BINARY);
         }
-      else if (stream->intern->func_read == es_func_fp_read)
+      else if (stream->intern->func_read == func_fp_read)
         {
           estream_cookie_fp_t fp_cookie = stream->intern->cookie;
 

-----------------------------------------------------------------------

Summary of changes:
 src/estream.c | 153 ++++++++++++++++++++++++++++++++++++----------------------
 1 file changed, 95 insertions(+), 58 deletions(-)


hooks/post-receive
-- 
Error codes used by GnuPG et al.
http://git.gnupg.org




More information about the Gnupg-commits mailing list