From 71d41a015add73e0fb355dd9713e99febd71d46f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 24 Mar 2012 16:00:36 +0100 Subject: libreplace: Add getpeereid implementation. --- lib/replace/wscript | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/replace/wscript') diff --git a/lib/replace/wscript b/lib/replace/wscript index e1dc1e6a30..025dda460d 100644 --- a/lib/replace/wscript +++ b/lib/replace/wscript @@ -174,6 +174,16 @@ def configure(conf): if not conf.CHECK_FUNCS('strlcpy strlcat'): conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h', checklibc=True) + if not conf.CHECK_FUNCS('getpeereid'): + conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h') + + conf.CHECK_CODE(''' + struct ucred cred; + socklen_t cred_len; + int ret = getsockopt(0, SOL_SOCKET, SO_PEERCRED, &cred, &cred_len);''', + 'HAVE_PEERCRED', + msg="Checking whether we can use SO_PEERCRED to get socket credentials", + headers='sys/types.h sys/socket.h') #Some OS (ie. freebsd) return EINVAL if the convertion could not be done, it's not what we expect #Let's detect those cases -- cgit