aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2025-12-11 06:45:24 +0100
committerNIIBE Yutaka <[email protected]>2025-12-11 06:55:51 +0100
commit46938bdde47579786c79770eb54b9b742a1e0365 (patch)
tree33fd914b686911b4ca8d611556d5fa5a2d05f661 /src
parentw32: Add a cast for GetProcAddress, add AM_CFLAGS for w32spawn. (diff)
downloadgpgme-46938bdde47579786c79770eb54b9b742a1e0365.tar.gz
gpgme-46938bdde47579786c79770eb54b9b742a1e0365.zip
Fix portability for the use of the assuan types.
* src/assuan-support.c (my_spawn, my_waitpid): Use assuan_pid_t. (my_socket, my_connect): Use assuan_fd_t. * src/engine-gpg.c (start): Remove unused PID. * src/engine-spawn.c (engspawn_start): Likewise. * src/gpgme-w32spawn.c: Add util.h for assuan types. * src/version.c: Likewise. * src/wait-user.c: Likewise. * src/posix-io.c (_gpgme_io_spawn): Use assuan_pid_t. * src/priv-io.h (_gpgme_io_spawn): Likewise. * src/w32-io.c (_gpgme_io_spawn): Likewise. * src/wait-private.c: Include util.h earlier. -- GnuPG-bug-id: 7968 Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/assuan-support.c14
-rw-r--r--src/engine-gpg.c3
-rw-r--r--src/engine-spawn.c3
-rw-r--r--src/gpgme-w32spawn.c1
-rw-r--r--src/key.c2
-rw-r--r--src/posix-io.c2
-rw-r--r--src/priv-io.h2
-rw-r--r--src/version.c1
-rw-r--r--src/w32-io.c2
-rw-r--r--src/wait-private.c2
-rw-r--r--src/wait-user.c1
11 files changed, 17 insertions, 16 deletions
diff --git a/src/assuan-support.c b/src/assuan-support.c
index c6052194..f473abf2 100644
--- a/src/assuan-support.c
+++ b/src/assuan-support.c
@@ -181,7 +181,7 @@ my_sendmsg (assuan_context_t ctx, assuan_fd_t fd, const assuan_msghdr_t msg,
to reflect the value of the FD in the peer process (on
Windows). */
static int
-my_spawn (assuan_context_t ctx, pid_t *r_pid, const char *name,
+my_spawn (assuan_context_t ctx, assuan_pid_t *r_pid, const char *name,
const char **argv,
assuan_fd_t fd_in, assuan_fd_t fd_out,
assuan_fd_t *fd_child_list,
@@ -309,8 +309,8 @@ my_spawn (assuan_context_t ctx, pid_t *r_pid, const char *name,
/* If action is 0, like waitpid. If action is 1, just release the PID? */
-static pid_t
-my_waitpid (assuan_context_t ctx, pid_t pid,
+static assuan_pid_t
+my_waitpid (assuan_context_t ctx, assuan_pid_t pid,
int nowait, int *status, int options)
{
(void)ctx;
@@ -351,20 +351,20 @@ my_socketpair (assuan_context_t ctx, int namespace, int style,
}
-static int
+static assuan_fd_t
my_socket (assuan_context_t ctx, int namespace, int style, int protocol)
{
(void)ctx;
- return _gpgme_io_socket (namespace, style, protocol);
+ return (assuan_fd_t)_gpgme_io_socket (namespace, style, protocol);
}
static int
-my_connect (assuan_context_t ctx, int sock, struct sockaddr *addr,
+my_connect (assuan_context_t ctx, assuan_fd_t sock, struct sockaddr *addr,
socklen_t length)
{
(void)ctx;
- return _gpgme_io_connect (sock, addr, length);
+ return _gpgme_io_connect ((int)sock, addr, length);
}
diff --git a/src/engine-gpg.c b/src/engine-gpg.c
index 4cc4dd83..c3c0b9d4 100644
--- a/src/engine-gpg.c
+++ b/src/engine-gpg.c
@@ -1752,7 +1752,6 @@ start (engine_gpg_t gpg)
int i, n;
int status;
struct spawn_fd_item_s *fd_list;
- pid_t pid;
const char *pgmname;
if (!gpg)
@@ -1849,7 +1848,7 @@ start (engine_gpg_t gpg)
status = _gpgme_io_spawn (pgmname, gpg->argv,
(IOSPAWN_FLAG_DETACHED |IOSPAWN_FLAG_ALLOW_SET_FG),
- fd_list, NULL, NULL, &pid);
+ fd_list, NULL, NULL, NULL);
{
int saved_err = gpg_error_from_syserror ();
free (fd_list);
diff --git a/src/engine-spawn.c b/src/engine-spawn.c
index 7fdac9ca..ee7aa113 100644
--- a/src/engine-spawn.c
+++ b/src/engine-spawn.c
@@ -230,7 +230,6 @@ engspawn_start (engine_spawn_t esp, const char *file, const char *argv[],
int i, n;
int status;
struct spawn_fd_item_s *fd_list;
- pid_t pid;
unsigned int spflags;
const char *save_argv0 = NULL;
@@ -273,7 +272,7 @@ engspawn_start (engine_spawn_t esp, const char *file, const char *argv[],
argv[0] = _gpgme_get_basename (file);
}
status = _gpgme_io_spawn (file, (char * const *)argv, spflags,
- fd_list, NULL, NULL, &pid);
+ fd_list, NULL, NULL, NULL);
if (save_argv0)
argv[0] = save_argv0;
free (fd_list);
diff --git a/src/gpgme-w32spawn.c b/src/gpgme-w32spawn.c
index 61ef9815..56918c96 100644
--- a/src/gpgme-w32spawn.c
+++ b/src/gpgme-w32spawn.c
@@ -38,6 +38,7 @@
#include <stdint.h>
#include <process.h>
+#include "util.h"
#include "priv-io.h"
/* #define DEBUG_TO_FILE 1 */
diff --git a/src/key.c b/src/key.c
index f980bb33..7e6165a7 100644
--- a/src/key.c
+++ b/src/key.c
@@ -459,7 +459,7 @@ gpgme_error_t
gpgme_key_from_uid (gpgme_key_t *r_key, const char *name)
{
gpgme_error_t err;
- gpgme_key_t key;
+ gpgme_key_t key = NULL;
*r_key = NULL;
err = _gpgme_key_new (&key);
diff --git a/src/posix-io.c b/src/posix-io.c
index 25351577..f8196f9b 100644
--- a/src/posix-io.c
+++ b/src/posix-io.c
@@ -544,7 +544,7 @@ int
_gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
struct spawn_fd_item_s *fd_list,
void (*atfork) (void *opaque, int reserved),
- void *atforkvalue, pid_t *r_pid)
+ void *atforkvalue, assuan_pid_t *r_pid)
{
pid_t pid;
int i;
diff --git a/src/priv-io.h b/src/priv-io.h
index d21f1b34..dbfb3a47 100644
--- a/src/priv-io.h
+++ b/src/priv-io.h
@@ -90,7 +90,7 @@ int _gpgme_io_set_nonblocking (int fd);
int _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
struct spawn_fd_item_s *fd_list,
void (*atfork) (void *opaque, int reserved),
- void *atforkvalue, pid_t *r_pid);
+ void *atforkvalue, assuan_pid_t *r_pid);
int _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock);
diff --git a/src/version.c b/src/version.c
index 8de900be..d5b171f2 100644
--- a/src/version.c
+++ b/src/version.c
@@ -31,6 +31,7 @@
#endif
#include "gpgme.h"
+#include "util.h"
#include "priv-io.h"
#include "debug.h"
#include "context.h"
diff --git a/src/w32-io.c b/src/w32-io.c
index 967d72cd..5fcaf78a 100644
--- a/src/w32-io.c
+++ b/src/w32-io.c
@@ -1368,7 +1368,7 @@ int
_gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
struct spawn_fd_item_s *fd_list,
void (*atfork) (void *opaque, int reserved),
- void *atforkvalue, pid_t *r_pid)
+ void *atforkvalue, assuan_pid_t *r_pid)
{
PROCESS_INFORMATION pi =
{
diff --git a/src/wait-private.c b/src/wait-private.c
index 703ee557..39014d1d 100644
--- a/src/wait-private.c
+++ b/src/wait-private.c
@@ -29,8 +29,8 @@
#include "context.h"
#include "wait.h"
#include "ops.h"
-#include "priv-io.h"
#include "util.h"
+#include "priv-io.h"
#include "debug.h"
diff --git a/src/wait-user.c b/src/wait-user.c
index 2a42170c..e8ccf6ce 100644
--- a/src/wait-user.c
+++ b/src/wait-user.c
@@ -24,6 +24,7 @@
#endif
#include <assert.h>
+#include "util.h"
#include "gpgme.h"
#include "context.h"
#include "priv-io.h"