aboutsummaryrefslogtreecommitdiffstats
path: root/src/system.c
diff options
context:
space:
mode:
authorMarcus Brinkmann <[email protected]>2009-11-25 17:55:26 +0000
committerMarcus Brinkmann <[email protected]>2009-11-25 17:55:26 +0000
commitb41cc03c891deac4bb35af3c88f8b635ebfb632c (patch)
treeccf200bd7e05c36da7a9ccf04a9b0e8bd9464be8 /src/system.c
parentdoc/ (diff)
downloadlibassuan-b41cc03c891deac4bb35af3c88f8b635ebfb632c.tar.gz
libassuan-b41cc03c891deac4bb35af3c88f8b635ebfb632c.zip
doc/
2009-11-25 Marcus Brinkmann <[email protected]> * assuan.texi (Data Types): Document assuan_fdopen. src/ 2009-11-25 Marcus Brinkmann <[email protected]> * assuan.h (assuan_init_pipe_server): Change type of filedes to assuan_fd_t. (assuan_fdopen): New prototype. * libassuan.vers, libassuan.def: Add assuan_fdopen. * system.c (assuan_fdopen): New function. * assuan-pipe-server.c (assuan_init_pipe_server): Change type of filedes to assuan_fd_t. No longer translate fd to handle. Don't set to binary either (that doesn't do anything for handles, it only affects the libc fd).
Diffstat (limited to 'src/system.c')
-rw-r--r--src/system.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/system.c b/src/system.c
index ab9e5a1..852ec11 100644
--- a/src/system.c
+++ b/src/system.c
@@ -44,6 +44,27 @@
#endif
+assuan_fd_t
+assuan_fdopen (int fd)
+{
+#ifdef HAVE_W32_SYSTEM
+ assuan_fd_t ifd = (assuan_fd_t) _get_osfhandle (fd);
+ assuan_fd_t ofd;
+
+ if (! DuplicateHandle(GetCurrentProcess(), hfd,
+ GetCurrentProcess(), &ofd, 0,
+ TRUE, DUPLICATE_SAME_ACCESS))
+ {
+ errno = EIO;
+ return ASSUAN_INVALID_FD:
+ }
+ return ofd;
+#else
+ return dup (fd);
+#endif
+}
+
+
/* Manage memory specific to a context. */
void *