2007-06-14 Havoc Pennington <hp@redhat.com>
authorHavoc Pennington <hp@redhat.com>
Thu, 14 Jun 2007 22:02:10 +0000 (22:02 +0000)
committerHavoc Pennington <hp@redhat.com>
Thu, 14 Jun 2007 22:02:10 +0000 (22:02 +0000)
* 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.

ChangeLog
bus/dispatch.c

index e5b9940..619eb95 100644 (file)
--- 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()
 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>
 
index ef75933..ed457dc 100644 (file)
@@ -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))