aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcus Brinkmann <[email protected]>2007-09-27 13:01:54 +0000
committerMarcus Brinkmann <[email protected]>2007-09-27 13:01:54 +0000
commit37ac53e74c6dd66c3df2ad052ef0302cf90cf4b0 (patch)
treeb119cced434baf2903f87527dafcc39bed26d918
parentdoc/ (diff)
downloadgpgme-37ac53e74c6dd66c3df2ad052ef0302cf90cf4b0.tar.gz
gpgme-37ac53e74c6dd66c3df2ad052ef0302cf90cf4b0.zip
2007-09-27 Marcus Brinkmann <[email protected]>
* assuan-pipe-connect.c (pipe_connect_gpgme): Do not close process handle here. Use this function also on Unix systems. gpgme/ 2007-09-27 Marcus Brinkmann <[email protected]> * w32-glib-io.c (_gpgme_io_spawn), w32-qt-io.cpp (_gpgme_io_spawn), w32-io.c (_gpgme_io_spawn): Close the process handle, return 0. tests/ 2007-09-27 Marcus Brinkmann <[email protected]> * t-engine-info.c (check_engine_info): Fix debug output. * gpg/Makefile.am (tests_unix): New variable. (TESTS): Use it. * gpg/t-support.h (passphrase_cb) [HAVE_W32_SYSTEM]: Use WriteFile instead of write. * gpg/t-wait.c [HAVE_W32_SYSTEM]: Define sleep as _sleep.
-rw-r--r--ChangeLog3
-rw-r--r--assuan/assuan-pipe-connect.c14
-rw-r--r--gpgme/ChangeLog4
-rw-r--r--gpgme/gpgme.h2
-rw-r--r--gpgme/w32-glib-io.c6
-rw-r--r--gpgme/w32-io.c6
-rw-r--r--gpgme/w32-qt-io.cpp6
-rw-r--r--tests/ChangeLog8
-rw-r--r--tests/gpg/Makefile.am16
-rw-r--r--tests/gpg/t-support.h10
-rw-r--r--tests/gpg/t-wait.c6
-rw-r--r--tests/t-engine-info.c6
12 files changed, 67 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index 553dda13..5cb11bcd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2007-09-27 Marcus Brinkmann <[email protected]>
+ * assuan-pipe-connect.c (pipe_connect_gpgme): Do not close process
+ handle here. Use this function also on Unix systems.
+
* assuan-pipe-connect.c (pipe_connect_gpgme): Fix last change.
* assuan-pipe-connect.c (pipe_connect_gpgme): New function, use it
diff --git a/assuan/assuan-pipe-connect.c b/assuan/assuan-pipe-connect.c
index 359eb494..e38b7877 100644
--- a/assuan/assuan-pipe-connect.c
+++ b/assuan/assuan-pipe-connect.c
@@ -181,6 +181,8 @@ initial_handshake (assuan_context_t *ctx)
}
+#ifndef _ASSUAN_IN_GPGME_BUILD_ASSUAN
+
#ifndef HAVE_W32_SYSTEM
#define pipe_connect pipe_connect_unix
/* Unix version of the pipe connection code. We use an extra macro to
@@ -365,6 +367,7 @@ pipe_connect_unix (assuan_context_t *ctx,
return initial_handshake (ctx);
}
#endif /*!HAVE_W32_SYSTEM*/
+#endif /* _ASSUAN_IN_GPGME_BUILD_ASSUAN */
#ifndef HAVE_W32_SYSTEM
@@ -550,6 +553,7 @@ socketpair_connect (assuan_context_t *ctx,
+
#ifdef _ASSUAN_IN_GPGME_BUILD_ASSUAN
#define pipe_connect pipe_connect_gpgme
@@ -570,7 +574,7 @@ pipe_connect_gpgme (assuan_context_t *ctx,
void *atforkvalue)
{
assuan_error_t err;
- int pid;
+ int res;
int rp[2];
int wp[2];
char mypidstr[50];
@@ -631,8 +635,8 @@ pipe_connect_gpgme (assuan_context_t *ctx,
child_fds[2].fd = -1;
/* Start the process. */
- pid = _gpgme_io_spawn (name, argv, child_fds, child_fds);
- if (pid == -1)
+ res = _gpgme_io_spawn (name, argv, child_fds, child_fds);
+ if (res == -1)
{
_assuan_log_printf ("CreateProcess failed: %s\n", strerror (errno));
_gpgme_io_close (rp[0]);
@@ -642,12 +646,8 @@ pipe_connect_gpgme (assuan_context_t *ctx,
return _assuan_error (ASSUAN_General_Error);
}
- /* ERR contains the PID. */
(*ctx)->pid = 0; /* We don't use the PID. */
- /* FIXME: Should be done by GPGME. */
- CloseHandle ((HANDLE) pid); /* We don't need to wait for the process. */
-
return initial_handshake (ctx);
}
diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog
index d8e1f96b..87557d8a 100644
--- a/gpgme/ChangeLog
+++ b/gpgme/ChangeLog
@@ -1,5 +1,9 @@
2007-09-27 Marcus Brinkmann <[email protected]>
+ * w32-glib-io.c (_gpgme_io_spawn),
+ w32-qt-io.cpp (_gpgme_io_spawn), w32-io.c (_gpgme_io_spawn): Close
+ the process handle, return 0.
+
* gpgme.h (gpgme_protocol_t): Add GPGME_PROTOCOL_UNKNOWN.
* gpgme.c (gpgme_get_protocol_name): Implement support for
GPGME_PROTOCOL_UNKNOWN.
diff --git a/gpgme/gpgme.h b/gpgme/gpgme.h
index 57bb0116..c0bc8e37 100644
--- a/gpgme/gpgme.h
+++ b/gpgme/gpgme.h
@@ -73,7 +73,7 @@ extern "C" {
AM_PATH_GPGME macro) check that this header matches the installed
library. Warning: Do not edit the next line. configure will do
that for you! */
-#define GPGME_VERSION "1.1.6-svn1258"
+#define GPGME_VERSION "1.1.6-svn1264"
diff --git a/gpgme/w32-glib-io.c b/gpgme/w32-glib-io.c
index 9d7eaf6c..3bd162f5 100644
--- a/gpgme/w32-glib-io.c
+++ b/gpgme/w32-glib-io.c
@@ -576,7 +576,11 @@ _gpgme_io_spawn (const char *path, char **argv,
(int) GetLastError ());
TRACE_SUC1 ("process=%p", pi.hProcess);
- return 0;
+
+ /* We don't need to wait for the process. */
+ CloseHandle (pi.hProcess);
+
+ return TRACE_SYSRES (0);
}
diff --git a/gpgme/w32-io.c b/gpgme/w32-io.c
index e83a2782..4af1b68f 100644
--- a/gpgme/w32-io.c
+++ b/gpgme/w32-io.c
@@ -1156,7 +1156,11 @@ _gpgme_io_spawn (const char *path, char **argv,
(int) GetLastError ());
TRACE_SUC1 ("process=%p", pi.hProcess);
- return handle_to_pid (pi.hProcess);
+
+ /* We don't need to wait for the process. */
+ CloseHandle (pi.hProcess);
+
+ return TRACE_SYSRES (0);
}
diff --git a/gpgme/w32-qt-io.cpp b/gpgme/w32-qt-io.cpp
index 50c4a97a..20b537bd 100644
--- a/gpgme/w32-qt-io.cpp
+++ b/gpgme/w32-qt-io.cpp
@@ -525,7 +525,11 @@ _gpgme_io_spawn (const char *path, char **argv,
(int) GetLastError ());
TRACE_SUC1 ("process=%p", pi.hProcess);
- return 0;
+
+ /* We don't need to wait for the process. */
+ CloseHandle (pi.hProcess);
+
+ return TRACE_SYSRES (0);
}
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 9e115e49..f57a4476 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,11 @@
+2007-09-27 Marcus Brinkmann <[email protected]>
+
+ * t-engine-info.c (check_engine_info): Fix debug output.
+ * gpg/Makefile.am (tests_unix): New variable.
+ (TESTS): Use it.
+ * gpg/t-support.h (passphrase_cb) [HAVE_W32_SYSTEM]: Use WriteFile instead of write.
+ * gpg/t-wait.c [HAVE_W32_SYSTEM]: Define sleep as _sleep.
+
2007-09-14 Marcus Brinkmann <[email protected]>
* gpgsm/t-verify.c (main): Release TEXT and SIG.
diff --git a/tests/gpg/Makefile.am b/tests/gpg/Makefile.am
index 023d2aaa..e5d9de9b 100644
--- a/tests/gpg/Makefile.am
+++ b/tests/gpg/Makefile.am
@@ -25,11 +25,17 @@ TESTS_ENVIRONMENT = GNUPGHOME=. GPG_AGENT_INFO=
# The keylist tests must come after the import and the edit test.
noinst_HEADERS = t-support.h
-TESTS = t-encrypt t-encrypt-sym t-encrypt-sign t-sign t-signers \
- t-decrypt t-verify t-decrypt-verify t-sig-notation \
- t-export t-import t-trustlist t-eventloop t-edit \
- t-keylist t-keylist-sig t-thread1 t-wait t-encrypt-large \
- t-file-name
+
+if HAVE_W32_SYSTEM
+tests_unix =
+else
+tests_unix = t-eventloop t-thread1
+endif
+
+TESTS = t-encrypt t-encrypt-sym t-encrypt-sign t-sign t-signers \
+ t-decrypt t-verify t-decrypt-verify t-sig-notation t-export \
+ t-import t-trustlist t-edit t-keylist t-keylist-sig t-wait \
+ t-encrypt-large t-file-name $(tests_unix)
CLEANFILES = secring.gpg pubring.gpg trustdb.gpg
DISTCLEANFILES = pubring.gpg~ random_seed gpg.conf
diff --git a/tests/gpg/t-support.h b/tests/gpg/t-support.h
index 0ed1ac84..362b857a 100644
--- a/tests/gpg/t-support.h
+++ b/tests/gpg/t-support.h
@@ -24,6 +24,10 @@
#include <stdlib.h>
#include <locale.h>
+#ifdef HAVE_W32_SYSTEM
+#include <windows.h>
+#endif
+
#include <gpgme.h>
#ifndef DIM
@@ -65,7 +69,13 @@ gpgme_error_t
passphrase_cb (void *opaque, const char *uid_hint, const char *passphrase_info,
int last_was_bad, int fd)
{
+#ifdef HAVE_W32_SYSTEM
+ DWORD written;
+ WriteFile ((HANDLE) fd, "abc\n", 4, &written, 0);
+#else
write (fd, "abc\n", 4);
+#endif
+
return 0;
}
diff --git a/tests/gpg/t-wait.c b/tests/gpg/t-wait.c
index c12835d7..eec4d96d 100644
--- a/tests/gpg/t-wait.c
+++ b/tests/gpg/t-wait.c
@@ -1,6 +1,6 @@
/* t-wait.c - Regression test.
Copyright (C) 2000 Werner Koch (dd9jn)
- Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH
+ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007 g10 Code GmbH
This file is part of GPGME.
@@ -29,6 +29,10 @@
#include <stdio.h>
#include <string.h>
+#ifdef HAVE_W32_SYSTEM
+#define sleep _sleep
+#endif
+
#include <gpgme.h>
#include "t-support.h"
diff --git a/tests/t-engine-info.c b/tests/t-engine-info.c
index 4af2d4a3..3864fe5f 100644
--- a/tests/t-engine-info.c
+++ b/tests/t-engine-info.c
@@ -1,5 +1,5 @@
/* t-engine-info.c - Regression test for gpgme_get_engine_info.
- Copyright (C) 2003, 2004 g10 Code GmbH
+ Copyright (C) 2003, 2004, 2007 g10 Code GmbH
This file is part of GPGME.
@@ -54,13 +54,13 @@ check_engine_info (gpgme_engine_info_t info, gpgme_protocol_t protocol,
}
if (strcmp (info->file_name, file_name))
{
- fprintf (stderr, "Unexpected file name to executable %s (expected %s instead)",
+ fprintf (stderr, "Unexpected file name to executable %s (expected %s instead)\n",
info->file_name, file_name);
exit (1);
}
if (strcmp (info->req_version, req_version))
{
- fprintf (stderr, "Unexpected required version %s (expected %s instead)",
+ fprintf (stderr, "Unexpected required version %s (expected %s instead)\n",
info->req_version, req_version);
exit (1);
}