summaryrefslogtreecommitdiff
path: root/sysutils/dbus/patches/patch-ab
blob: 2f9a302093b006ffa8d565eea78bc6052f023781 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
$NetBSD: patch-ab,v 1.12 2008/06/19 01:56:44 bjs Exp $

--- dbus/dbus-sysdeps-unix.c.orig	2008-04-04 11:24:08.000000000 -0400
+++ dbus/dbus-sysdeps-unix.c
@@ -35,6 +35,9 @@
 #include "dbus-list.h"
 #include "dbus-credentials.h"
 
+#ifdef HAVE_NETBSD_ATOMIC_OPS
+#include <sys/atomic.h>
+#endif
 #include <sys/types.h>
 #include <stdlib.h>
 #include <string.h>
@@ -786,7 +789,9 @@ _dbus_connect_tcp_socket (const char    
   fprintf(stderr, "Family %s\n", family ? family : "none");
   hints.ai_protocol = IPPROTO_TCP;
   hints.ai_socktype = SOCK_STREAM;
+#ifdef AI_ADDRCONFIG
   hints.ai_flags = AI_ADDRCONFIG;
+#endif
 
   if ((res = getaddrinfo(host, port, &hints, &ai)) != 0)
     {
@@ -889,7 +894,11 @@ _dbus_listen_tcp_socket (const char     
 
   hints.ai_protocol = IPPROTO_TCP;
   hints.ai_socktype = SOCK_STREAM;
+#ifdef AI_ADDRCONFIG
   hints.ai_flags = AI_ADDRCONFIG | AI_PASSIVE;
+#else
+  hints.ai_flags = AI_PASSIVE;
+#endif
 
  redo_lookup_with_port:
   if ((res = getaddrinfo(host, port, &hints, &ai)) != 0 || !ai)
@@ -1753,7 +1762,26 @@ _dbus_parse_uid (const DBusString      *
   return TRUE;
 }
 
+#ifdef HAVE_NETBSD_ATOMIC_OPS
+dbus_int32_t
+_dbus_atomic_inc (DBusAtomic *atomic)
+{
+	register dbus_int32_t old = atomic->value;
+
+	atomic_inc_uint((unsigned *)&atomic->value);
+	return old;
+}
 
+dbus_int32_t
+_dbus_atomic_dec (DBusAtomic *atomic)
+{
+	register dbus_int32_t old = atomic->value;
+
+	atomic_dec_uint((unsigned *)&atomic->value);
+  	return old;
+}
+_DBUS_DEFINE_GLOBAL_LOCK (atomic);
+#else
 _DBUS_DEFINE_GLOBAL_LOCK (atomic);
 
 #if DBUS_USE_ATOMIC_INT_486_COND
@@ -1818,6 +1846,7 @@ _dbus_atomic_dec (DBusAtomic *atomic)
   return res;
 #endif
 }
+#endif /* HAVE_NETBSD_ATOMIC_OPS */
 
 #ifdef DBUS_BUILD_TESTS
 /** Gets our GID
@@ -2711,8 +2740,18 @@ int
 _dbus_printf_string_upper_bound (const char *format,
                                  va_list     args)
 {
+#if defined(__hpux) || defined(__sgi)
+/* this code from libnbcompat's vsnprintf */
+  static FILE *devnull = 0;
+  if (!devnull) {
+    devnull = fopen("/dev/null", "w");
+    if (!devnull) return -1;
+  }
+  return vfprintf(devnull, format, args);
+#else
   char c;
   return vsnprintf (&c, 1, format, args);
+#endif
 }
 
 /**