[svn] gpgme - r1229 - trunk/gpgme
svn author marcus
cvs at cvs.gnupg.org
Tue Jul 10 18:07:21 CEST 2007
Author: marcus
Date: 2007-07-10 18:06:44 +0200 (Tue, 10 Jul 2007)
New Revision: 1229
Modified:
trunk/gpgme/ChangeLog
trunk/gpgme/engine-gpgsm.c
trunk/gpgme/posix-io.c
trunk/gpgme/priv-io.h
trunk/gpgme/w32-glib-io.c
trunk/gpgme/w32-io.c
Log:
2007-07-10 Marcus Brinkmann <marcus at g10code.de>
* priv-io.h (_gpgme_io_dup): New prototype.
* posix-io.c (_gpgme_io_dup): New function.
* w32-io.c (_gpgme_io_dup): Likewise.
* w32-glib-io.c (_gpgme_io_dup): Likewise.
* engine-gpgsm.c (start): Use _gpgme_dup() instead of dup().
Modified: trunk/gpgme/ChangeLog
===================================================================
--- trunk/gpgme/ChangeLog 2007-07-09 13:45:06 UTC (rev 1228)
+++ trunk/gpgme/ChangeLog 2007-07-10 16:06:44 UTC (rev 1229)
@@ -1,3 +1,11 @@
+2007-07-10 Marcus Brinkmann <marcus at g10code.de>
+
+ * priv-io.h (_gpgme_io_dup): New prototype.
+ * posix-io.c (_gpgme_io_dup): New function.
+ * w32-io.c (_gpgme_io_dup): Likewise.
+ * w32-glib-io.c (_gpgme_io_dup): Likewise.
+ * engine-gpgsm.c (start): Use _gpgme_dup() instead of dup().
+
2007-07-08 Marcus Brinkmann <marcus at g10code.de>
* engine-gpgsm.c [HAVE_W32_SYSTEM]: Enable the bunch of the file.
Modified: trunk/gpgme/engine-gpgsm.c
===================================================================
--- trunk/gpgme/engine-gpgsm.c 2007-07-09 13:45:06 UTC (rev 1228)
+++ trunk/gpgme/engine-gpgsm.c 2007-07-10 16:06:44 UTC (rev 1229)
@@ -988,7 +988,8 @@
status_fd and register/unregister it manually as needed, but this
increases code duplication and is more complicated as we can not
use the close notifications etc. */
- gpgsm->status_cb.fd = dup (fdlist[0]);
+
+ gpgsm->status_cb.fd = _gpgme_io_dup (fdlist[0]);
if (gpgsm->status_cb.fd < 0)
return gpg_error_from_syserror ();
Modified: trunk/gpgme/posix-io.c
===================================================================
--- trunk/gpgme/posix-io.c 2007-07-09 13:45:06 UTC (rev 1228)
+++ trunk/gpgme/posix-io.c 2007-07-10 16:06:44 UTC (rev 1229)
@@ -495,3 +495,8 @@
}
+int
+_gpgme_io_dup (int fd)
+{
+ return dup (fd);
+}
Modified: trunk/gpgme/priv-io.h
===================================================================
--- trunk/gpgme/priv-io.h 2007-07-09 13:45:06 UTC (rev 1228)
+++ trunk/gpgme/priv-io.h 2007-07-10 16:06:44 UTC (rev 1229)
@@ -64,4 +64,7 @@
line that the child process expects. */
int _gpgme_io_fd2str (char *buf, int buflen, int fd);
+/* Like dup(). */
+int _gpgme_io_dup (int fd);
+
#endif /* IO_H */
Modified: trunk/gpgme/w32-glib-io.c
===================================================================
--- trunk/gpgme/w32-glib-io.c 2007-07-09 13:45:06 UTC (rev 1228)
+++ trunk/gpgme/w32-glib-io.c 2007-07-10 16:06:44 UTC (rev 1229)
@@ -660,3 +660,11 @@
free (pollfds_map);
return count;
}
+
+
+int
+_gpgme_io_dup (int fd)
+{
+ return _dup (fd);
+}
+
Modified: trunk/gpgme/w32-io.c
===================================================================
--- trunk/gpgme/w32-io.c 2007-07-09 13:45:06 UTC (rev 1228)
+++ trunk/gpgme/w32-io.c 2007-07-10 16:06:44 UTC (rev 1229)
@@ -1140,6 +1140,25 @@
return snprintf (buf, buflen, "%d", fd);
}
+
+int
+_gpgme_io_dup (int fd)
+{
+ HANDLE handle = fd_to_handle (fd);
+ HANDLE new_handle = fd_to_handle (fd);
+
+ /* For NT we have to set the sync flag. It seems that the only
+ * way to do it is by duplicating the handle. Tsss.. */
+ if (!DuplicateHandle( GetCurrentProcess(), handle,
+ GetCurrentProcess(), &new_handle,
+ 0, FALSE, DUPLICATE_SAME_ACCESS))
+ {
+ DEBUG1 ("** DuplicateHandle failed: ec=%d\n", (int) GetLastError());
+ }
+
+ return handle_to_fd (new_handle);
+}
+
/* The following interface is only useful for GPGME Glib. */
More information about the Gnupg-commits
mailing list