summaryrefslogtreecommitdiffstats
path: root/dbus
diff options
context:
space:
mode:
authorJohn (J5) Palmieri <johnp@redhat.com>2006-10-26 19:01:10 +0000
committerJohn (J5) Palmieri <johnp@redhat.com>2006-10-26 19:01:10 +0000
commitcaae991f97ce1b09595d3229f2868268678b8de6 (patch)
treef0c8b8244742ca1c251c42de345bb80af099f3b0 /dbus
parent82c9cd05cd19a397043db94025c7a80e75386e8a (diff)
* dbus-sysdeps-unix.c (_dbus_set_local_creds): Clean up the
LOCAL_CREDS vs CMSGCRED stuff a bit. Prefer CMSGCRED. This needs to be cleaned up more. * doc/TODO: Add a todo that *BSD hackers should look at cleaning up the CREDS issue.
Diffstat (limited to 'dbus')
-rw-r--r--dbus/dbus-sysdeps-unix.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c
index 45764050..75848b71 100644
--- a/dbus/dbus-sysdeps-unix.c
+++ b/dbus/dbus-sysdeps-unix.c
@@ -515,7 +515,11 @@ _dbus_set_local_creds (int fd, dbus_bool_t on)
{
dbus_bool_t retval = TRUE;
-#if defined(LOCAL_CREDS) && !defined(HAVE_CMSGCRED)
+#if defined(HAVE_CMSGCRED)
+ /* NOOP just to make sure only one codepath is used
+ * and to prefer CMSGCRED
+ */
+#elif defined(LOCAL_CREDS)
int val = on ? 1 : 0;
if (setsockopt (fd, 0, LOCAL_CREDS, &val, sizeof (val)) < 0)
{
@@ -828,16 +832,13 @@ write_credentials_byte (int server_fd,
{
int bytes_written;
char buf[1] = { '\0' };
-#if defined(HAVE_CMSGCRED) && !defined(LOCAL_CREDS)
+#if defined(HAVE_CMSGCRED)
struct {
struct cmsghdr hdr;
struct cmsgcred cred;
} cmsg;
struct iovec iov;
struct msghdr msg;
-#endif
-
-#if defined(HAVE_CMSGCRED) && !defined(LOCAL_CREDS)
iov.iov_base = buf;
iov.iov_len = 1;
@@ -857,7 +858,7 @@ write_credentials_byte (int server_fd,
again:
-#if defined(HAVE_CMSGCRED) && !defined(LOCAL_CREDS)
+#if defined(HAVE_CMSGCRED)
bytes_written = sendmsg (server_fd, &msg, 0);
#else
bytes_written = write (server_fd, buf, 1);