Re: [Libtirpc-devel] updated macOS support for tirpc [1/7] getpeereid

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 10/1/24 4:47 PM, Daria Phoebe Brashear wrote:
 From 068c57e42a1f6cbc73f2c34259613d48d2fc86ec Mon Sep 17 00:00:00 2001
From: Daria Phoebe Brashear <shadow@xxxxxxxxx>
Date: Tue, 1 Oct 2024 14:57:38 -0400
Subject: [PATCH 1/9] check for getpeereid

macos ships with it, this avoids trying to build a replacement for a defined
function

Signed-off-by: Daria Phoebe Brashear <shadow@xxxxxxxxx>
All 9 patches are committed (tag: libtirpc-1-3-6-rc3)

steved.
---
  configure.ac     | 2 +-
  src/getpeereid.c | 7 +++++++
  2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 756c958..3d5c914 100644
--- a/configure.ac
+++ b/configure.ac
@@ -95,7 +95,7 @@ AC_HEADER_DIRENT
  AC_PREFIX_DEFAULT(/usr)
  AC_CHECK_HEADERS([arpa/inet.h fcntl.h libintl.h limits.h locale.h
netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h
sys/param.h sys/socket.h sys/time.h syslog.h unistd.h features.h
gssapi/gssapi_ext.h])
  AX_PTHREAD
-AC_CHECK_FUNCS([getrpcbyname getrpcbynumber setrpcent endrpcent getrpcent])
+AC_CHECK_FUNCS([getpeereid getrpcbyname getrpcbynumber setrpcent
endrpcent getrpcent])

  AC_CONFIG_FILES([Makefile src/Makefile man/Makefile doc/Makefile])
  AC_OUTPUT(libtirpc.pc)
diff --git a/src/getpeereid.c b/src/getpeereid.c
index dd85270..e1e551b 100644
--- a/src/getpeereid.c
+++ b/src/getpeereid.c
@@ -24,6 +24,9 @@
   * SUCH DAMAGE.
   */

+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif

  #include <sys/param.h>
  #include <sys/socket.h>
@@ -32,6 +35,8 @@
  #include <errno.h>
  #include <unistd.h>

+#if !HAVE_GETPEEREID
+
  int
  getpeereid(int s, uid_t *euid, gid_t *egid)
  {
@@ -49,3 +54,5 @@ getpeereid(int s, uid_t *euid, gid_t *egid)
      *egid = uc.gid;
      return (0);
   }
+
+#endif





[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux