[Pkg-gnupg-commit] [libassuan] 133/437: (assuan_init_pipe_server) [W32]: Map file descriptors using _get_osfhandle.
Eric Dorland
eric at moszumanska.debian.org
Fri May 22 05:33:33 UTC 2015
This is an automated email from the git hooks/post-receive script.
eric pushed a commit to branch master
in repository libassuan.
commit 90e65a7d672e6b56148393ff2b6f8c52bc081ae5
Author: Werner Koch <wk at gnupg.org>
Date: Sun Dec 19 13:34:54 2004 +0000
(assuan_init_pipe_server) [W32]: Map file
descriptors using _get_osfhandle.
---
src/ChangeLog | 5 +++++
src/assuan-pipe-server.c | 18 ++++++++++++++++--
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/src/ChangeLog b/src/ChangeLog
index 2c73cfb..4f4061b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2004-12-19 Werner Koch <wk at g10code.com>
+
+ * assuan-pipe-server.c (assuan_init_pipe_server) [W32]: Map file
+ descriptors using _get_osfhandle.
+
2004-12-19 Moritz Schulte <moritz at g10code.com>
* assuan-pipe-connect.c (assuan_pipe_connect2): Removed "`"
diff --git a/src/assuan-pipe-server.c b/src/assuan-pipe-server.c
index 7b2d643..beff9a3 100644
--- a/src/assuan-pipe-server.c
+++ b/src/assuan-pipe-server.c
@@ -22,9 +22,14 @@
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
+#ifdef HAVE_W32_SYSTEM
+#include <windows.h>
+#include <fcntl.h>
+#endif
#include "assuan-defs.h"
+
static void
deinit_pipe_server (ASSUAN_CONTEXT ctx)
{
@@ -83,7 +88,6 @@ _assuan_new_context (ASSUAN_CONTEXT *r_ctx)
}
-
int
assuan_init_pipe_server (ASSUAN_CONTEXT *r_ctx, int filedes[2])
{
@@ -97,8 +101,18 @@ assuan_init_pipe_server (ASSUAN_CONTEXT *r_ctx, int filedes[2])
unsigned long ul;
ctx->is_server = 1;
- ctx->inbound.fd = filedes[0];
+#ifdef HAVE_W32_SYSTEM
+ /* MS Windows has so many different types of handle that one
+ needs to tranlsate them at many place forth and back. Also
+ make sure that the fiel descriptos are in binary mode. */
+ setmode (filedes[0], O_BINARY);
+ setmode (filedes[1], O_BINARY);
+ ctx->inbound.fd = _get_osfhandle (filedes[0]);
+ ctx->outbound.fd = _get_osfhandle (filedes[1]);
+#else
+ ctx->inbound.fd = filedes[0];
ctx->outbound.fd = filedes[1];
+#endif
ctx->pipe_mode = 1;
s = getenv ("_assuan_pipe_connect_pid");
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/libassuan.git
More information about the Pkg-gnupg-commit
mailing list