+2010-05-07 Marcus Brinkmann <marcus@g10code.de>
+
+ * engine-gpgsm.c (gpgsm_new, start): Cast between int and
+ assuan_fd_t.
+ * assuan-support.c (my_pipe, my_close, my_read, my_write): Likewise.
+ * gpgme-tool.c (server_data_obj, server_reset_fds, gpgme_server),
+ (my_recvmsg, my_sendmsg, my_spawn): Likewise.
+ * engine-assuan.c (start): Likewise.
+ * engine-g13.c (start): Likewise.
+
2010-05-06 Marcus Brinkmann <marcus@g10code.de>
* w32-glib-io.c, w32-io.c, w32-qt-io.cpp, w32-sema.c, w32-util.c:
__assuan_usleep (ctx, usec);
}
+
/* Create a pipe with an inheritable end. */
static int
my_pipe (assuan_context_t ctx, assuan_fd_t fds[2], int inherit_idx)
{
- return _gpgme_io_pipe (fds, inherit_idx);
+ int res;
+ int gfds[2];
+
+ res = _gpgme_io_pipe (gfds, inherit_idx);
+
+ /* For now... */
+ fds[0] = (assuan_fd_t) gfds[0];
+ fds[1] = (assuan_fd_t) gfds[1];
+
+ return res;
}
static int
my_close (assuan_context_t ctx, assuan_fd_t fd)
{
- return _gpgme_io_close (fd);
+ return _gpgme_io_close ((int) fd);
}
static ssize_t
my_read (assuan_context_t ctx, assuan_fd_t fd, void *buffer, size_t size)
{
- return _gpgme_io_read (fd, buffer, size);
+ return _gpgme_io_read ((int) fd, buffer, size);
}
static ssize_t
my_write (assuan_context_t ctx, assuan_fd_t fd, const void *buffer, size_t size)
{
- return _gpgme_io_write (fd, buffer, size);
+ return _gpgme_io_write ((int) fd, buffer, size);
}
gpg_err_set_errno (ENOSYS);
return -1;
#else
- return _gpgme_io_recvmsg (fd, msg, flags);
+ return _gpgme_io_recvmsg ((int) fd, msg, flags);
#endif
}
gpg_err_set_errno (ENOSYS);
return -1;
#else
- return _gpgme_io_sendmsg (fd, msg, flags);
+ return _gpgme_io_sendmsg ((int) fd, msg, flags);
#endif
}
{
while (fd_child_list[i] != ASSUAN_INVALID_FD)
{
- fd_items[i].fd = fd_child_list[i];
+ fd_items[i].fd = (int) fd_child_list[i];
fd_items[i].dup_to = -1;
i++;
}
}
if (fd_in != ASSUAN_INVALID_FD)
{
- fd_items[i].fd = fd_in;
+ fd_items[i].fd = (int) fd_in;
fd_items[i].dup_to = 0;
i++;
}
if (fd_out != ASSUAN_INVALID_FD)
{
- fd_items[i].fd = fd_out;
+ fd_items[i].fd = (int) fd_out;
fd_items[i].dup_to = 1;
i++;
}
{
while (fd_child_list[i] != ASSUAN_INVALID_FD)
{
- fd_child_list[i] = fd_items[i].peer_name;
+ fd_child_list[i] = (assuan_fd_t) fd_items[i].peer_name;
i++;
}
}
start (engine_llass_t llass, const char *command)
{
gpgme_error_t err;
+ assuan_fd_t afdlist[5];
int fdlist[5];
int nfds;
+ int i;
/* We need to know the fd used by assuan for reads. We do this by
using the assumption that the first returned fd from
assuan_get_active_fds() is always this one. */
nfds = assuan_get_active_fds (llass->assuan_ctx, 0 /* read fds */,
- fdlist, DIM (fdlist));
+ afdlist, DIM (afdlist));
if (nfds < 1)
return gpg_error (GPG_ERR_GENERAL); /* FIXME */
+ /* For now... */
+ for (i = 0; i < nfds; i++)
+ fdlist[i] = (int) afdlist[i];
/* We "duplicate" the file descriptor, so we can close it here (we
can't close fdlist[0], as that is closed by libassuan, and
start (engine_g13_t g13, const char *command)
{
gpgme_error_t err;
+ assuan_fd_t afdlist[5];
int fdlist[5];
int nfds;
+ int i;
/* We need to know the fd used by assuan for reads. We do this by
using the assumption that the first returned fd from
assuan_get_active_fds() is always this one. */
nfds = assuan_get_active_fds (g13->assuan_ctx, 0 /* read fds */,
- fdlist, DIM (fdlist));
+ afdlist, DIM (afdlist));
if (nfds < 1)
return gpg_error (GPG_ERR_GENERAL); /* FIXME */
+ /* For now... */
+ for (i = 0; i < nfds; i++)
+ fdlist[i] = (int) afdlist[i];
/* We "duplicate" the file descriptor, so we can close it here (we
can't close fdlist[0], as that is closed by libassuan, and
(gpgsm->assuan_ctx, file_name ? file_name : _gpgme_get_gpgsm_path (),
argv, NULL, NULL, NULL, ASSUAN_PIPE_CONNECT_FDPASSING);
#else
- err = assuan_pipe_connect
- (gpgsm->assuan_ctx, file_name ? file_name : _gpgme_get_gpgsm_path (),
- argv, child_fds, NULL, NULL, 0);
+ {
+ assuan_fd_t achild_fds[4];
+ int i;
+
+ /* For now... */
+ for (i = 0; i < 4; i++)
+ achild_fds[i] = (assuan_fd_t) child_fds[i];
+
+ err = assuan_pipe_connect
+ (gpgsm->assuan_ctx, file_name ? file_name : _gpgme_get_gpgsm_path (),
+ argv, achild_fds, NULL, NULL, 0);
+ }
/* On Windows, handles are inserted in the spawned process with
DuplicateHandle, and child_fds contains the server-local names
start (engine_gpgsm_t gpgsm, const char *command)
{
gpgme_error_t err;
+ assuan_fd_t afdlist[5];
int fdlist[5];
int nfds;
+ int i;
/* We need to know the fd used by assuan for reads. We do this by
using the assumption that the first returned fd from
assuan_get_active_fds() is always this one. */
nfds = assuan_get_active_fds (gpgsm->assuan_ctx, 0 /* read fds */,
- fdlist, DIM (fdlist));
+ afdlist, DIM (afdlist));
if (nfds < 1)
return gpg_error (GPG_ERR_GENERAL); /* FIXME */
+ /* For now... */
+ for (i = 0; i < nfds; i++)
+ fdlist[i] = (int) afdlist[i];
/* We "duplicate" the file descriptor, so we can close it here (we
can't close fdlist[0], as that is closed by libassuan, and
{
gpgme_error_t err;
- err = gpgme_data_new_from_fd (data, fd);
+ /* For now... */
+ err = gpgme_data_new_from_fd (data, (int) fd);
if (err)
return err;
return gpgme_data_set_encoding (*data, encoding);
here. */
assuan_close_input_fd (server->assuan_ctx);
assuan_close_output_fd (server->assuan_ctx);
- if (server->message_fd != -1)
+ if (server->message_fd != ASSUAN_INVALID_FD)
{
/* FIXME: Assuan should provide a close function. */
+#if HAVE_W32_SYSTEM
+ CloseHandle (server->message_fd);
+#else
close (server->message_fd);
- server->message_fd = -1;
+#endif
+ server->message_fd = ASSUAN_INVALID_FD;
}
server->input_enc = GPGME_DATA_ENCODING_NONE;
server->output_enc = GPGME_DATA_ENCODING_NONE;
static const char hello[] = ("GPGME-Tool " VERSION " ready");
memset (&server, 0, sizeof (server));
- server.message_fd = -1;
+ server.message_fd = ASSUAN_INVALID_FD;
server.input_enc = GPGME_DATA_ENCODING_NONE;
server.output_enc = GPGME_DATA_ENCODING_NONE;
server.message_enc = GPGME_DATA_ENCODING_NONE;