From 110a375401878b72984241c0dd84cb7fdeaae795 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Tue, 5 Apr 2022 14:17:21 +0900 Subject: [PATCH] core: Don't keep using deprecated ath_ API. * src/posix-io.c: Don't include ath.h. (_gpgme_io_read): Call read directly. (_gpgme_io_write): Call write directly. (_gpgme_io_waitpid): Call waitpid directly. (_gpgme_io_select_select): Call select directly. (_gpgme_io_recvmsg): Call recvmsg directly. (_gpgme_io_sendmsg): Call sendmsg directly. (_gpgme_io_connect): Call connect directly. * src/assuan-support.c: Don't include ath.h. (my_waitpid): Call waitpid directly. -- Signed-off-by: NIIBE Yutaka --- src/assuan-support.c | 10 ++++++++-- src/posix-io.c | 24 +++++++++++++++--------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/assuan-support.c b/src/assuan-support.c index 0ddf29b6..7f5b5da9 100644 --- a/src/assuan-support.c +++ b/src/assuan-support.c @@ -27,10 +27,16 @@ #include #include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifndef HAVE_W32_SYSTEM +#include +#endif + #include "assuan.h" #include "gpgme.h" -#include "ath.h" #include "priv-io.h" #include "debug.h" @@ -294,7 +300,7 @@ my_waitpid (assuan_context_t ctx, pid_t pid, NOWAIT in POSIX systems just means the caller already did the waitpid for this child. */ if (! nowait) - return _gpgme_ath_waitpid (pid, status, options); + return waitpid (pid, status, options); #endif return 0; } diff --git a/src/posix-io.c b/src/posix-io.c index 5c6cf1df..a422d8f6 100644 --- a/src/posix-io.c +++ b/src/posix-io.c @@ -54,11 +54,18 @@ # include #endif /*USE_LINUX_GETDENTS*/ +#ifdef HAVE_POLL_H +# include +#else +# ifdef HAVE_SYS_SELECT_H +# include +# endif +#endif +#include #include "util.h" #include "priv-io.h" #include "sema.h" -#include "ath.h" #include "debug.h" @@ -178,7 +185,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count) do { - nread = _gpgme_ath_read (fd, buffer, count); + nread = read (fd, buffer, count); } while (nread == -1 && errno == EINTR); @@ -197,7 +204,7 @@ _gpgme_io_write (int fd, const void *buffer, size_t count) do { - nwritten = _gpgme_ath_write (fd, buffer, count); + nwritten = write (fd, buffer, count); } while (nwritten == -1 && errno == EINTR); @@ -490,7 +497,7 @@ _gpgme_io_waitpid (int pid, int hang, int *r_status, int *r_signal) *r_status = 0; *r_signal = 0; do - ret = _gpgme_ath_waitpid (pid, &status, hang? 0 : WNOHANG); + ret = waitpid (pid, &status, hang? 0 : WNOHANG); while (ret == (pid_t)(-1) && errno == EINTR); if (ret == pid) @@ -869,8 +876,7 @@ _gpgme_io_select_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) do { - count = _gpgme_ath_select (max_fd + 1, &readfds, &writefds, NULL, - &timeout); + count = select (max_fd + 1, &readfds, &writefds, NULL, &timeout); } while (count < 0 && errno == EINTR); if (count < 0) @@ -946,7 +952,7 @@ _gpgme_io_recvmsg (int fd, struct msghdr *msg, int flags) do { - nread = _gpgme_ath_recvmsg (fd, msg, flags); + nread = recvmsg (fd, msg, flags); } while (nread == -1 && errno == EINTR); saved_errno = errno; @@ -996,7 +1002,7 @@ _gpgme_io_sendmsg (int fd, const struct msghdr *msg, int flags) do { - nwritten = _gpgme_ath_sendmsg (fd, msg, flags); + nwritten = sendmsg (fd, msg, flags); } while (nwritten == -1 && errno == EINTR); return TRACE_SYSRES (nwritten); @@ -1041,7 +1047,7 @@ _gpgme_io_connect (int fd, struct sockaddr *addr, int addrlen) "fd=%d addr=%p addrlen=%i", fd, addr, addrlen); do - res = ath_connect (fd, addr, addrlen); + res = connect (fd, addr, addrlen); while (res == -1 && errno == EINTR); return TRACE_SYSRES (res);