_dbus_read_credentials_socket: support OpenBSD
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Fri, 21 Jan 2011 13:27:18 +0000 (13:27 +0000)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Fri, 21 Jan 2011 13:27:18 +0000 (13:27 +0000)
OpenBSD SO_PEERCRED is nearly the same as Linux SO_PEERCRED, but the
struct is named differently. Sigh.

Based on a patch from 'ajacoutot'.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=32542

dbus/dbus-sysdeps-unix.c

index 8104073..fdea634 100644 (file)
@@ -1660,7 +1660,11 @@ _dbus_read_credentials_socket  (int              client_fd,
 
   {
 #ifdef SO_PEERCRED
+#ifdef __OpenBSD__
+    struct sockpeercred cr;
+#else
     struct ucred cr;
+#endif
     int cr_len = sizeof (cr);
 
     if (getsockopt (client_fd, SOL_SOCKET, SO_PEERCRED, &cr, &cr_len) == 0 &&