summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2007-06-14 22:02:10 +0000
committerHavoc Pennington <hp@redhat.com>2007-06-14 22:02:10 +0000
commitbfd6be8555945c01da8772643f71ba511c52cc34 (patch)
tree783d72c1046689a1cd3dcbd2df594d3575a5719e
parente7c0d217795f4e8eb618f82b9b3e52807436c8f1 (diff)
2007-06-14 Havoc Pennington <hp@redhat.com>
* bus/dispatch.c (check_get_connection_unix_process_id): mop up getpid() (noticed by Peter KKümmel) and adapt the test to expect a "pid unknown" error when running on Windows.
-rw-r--r--ChangeLog8
-rw-r--r--bus/dispatch.c27
2 files changed, 26 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index e5b9940e..619eb952 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2007-06-14 Havoc Pennington <hp@redhat.com>
+ * bus/dispatch.c (check_get_connection_unix_process_id): mop up
+ getpid() (noticed by Peter KKümmel) and adapt the test to
+ expect a "pid unknown" error when running on Windows.
+
+2007-06-14 Havoc Pennington <hp@redhat.com>
+
* dbus/dbus-sysdeps-unix.c (_dbus_credentials_parse_and_add_user):
delete this function since it was effectively the same as
_dbus_credentials_add_from_username()
@@ -214,7 +220,7 @@
2007-05-27 Ralf Habacker <ralf.habacker@freenet.de>
* bus/policy.c,dbus/dbus-internals.c: fixed inconsistant line endings
- as reported by Peter Kümmel.
+ as reported by Peter Kümmel.
2007-05-25 John (J5) Palmieri <johnp@redhat.com>
diff --git a/bus/dispatch.c b/bus/dispatch.c
index ef75933f..ed457dc4 100644
--- a/bus/dispatch.c
+++ b/bus/dispatch.c
@@ -399,10 +399,6 @@ bus_dispatch_remove_connection (DBusConnection *connection)
#ifdef DBUS_BUILD_TESTS
#include <stdio.h>
-#ifdef DBUS_UNIX
-#include <sys/types.h>
-#include <unistd.h>
-#endif
/* This is used to know whether we need to block in order to finish
* sending a message, or whether the initial dbus_connection_send()
@@ -1268,15 +1264,28 @@ check_get_connection_unix_process_id (BusContext *context,
{
; /* good, this is a valid response */
}
+#ifdef DBUS_WIN
+ else if (dbus_message_is_error (message, DBUS_ERROR_UNIX_PROCESS_ID_UNKNOWN))
+ {
+ /* We are expecting this error, since we know in the test suite we aren't
+ * talking to a client running on UNIX
+ */
+ _dbus_verbose ("Windows correctly does not support GetConnectionUnixProcessID\n");
+ }
+#endif
else
{
warn_unexpected (connection, message, "not this error");
-
+
goto out;
}
}
else
{
+#ifdef DBUS_WIN
+ warn_unexpected (connection, message, "GetConnectionUnixProcessID to fail on Windows");
+ goto out;
+#else
if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_METHOD_RETURN)
{
; /* good, expected */
@@ -1308,8 +1317,9 @@ check_get_connection_unix_process_id (BusContext *context,
_dbus_warn ("Did not get the expected DBUS_TYPE_UINT32 from GetConnectionUnixProcessID\n");
goto out;
}
- } else {
-
+ }
+ else
+ {
/* test if returned pid is the same as our own pid
*
* @todo It would probably be good to restructure the tests
@@ -1317,13 +1327,14 @@ check_get_connection_unix_process_id (BusContext *context,
* cause then we can test that the pid returned matches
* getppid()
*/
- if (pid != (dbus_uint32_t) getpid ())
+ if (pid != (dbus_uint32_t) _dbus_getpid ())
{
_dbus_assert (dbus_error_is_set (&error));
_dbus_warn ("Result from GetConnectionUnixProcessID is not our own pid\n");
goto out;
}
}
+#endif /* !DBUS_WIN */
}
if (!check_no_leftovers (context))