<listen> element of the configuration file

Ralf Habacker ralf.habacker at freenet.de
Fri Mar 9 10:33:09 PST 2007


Ralf Habacker schrieb:
> Luigi Paioro schrieb:
>> Sure! :-)
>>
> I've tried to apply this patch on win32 and got problems with it.
> Because this patch changes the signature for _dbus_listen_tcp_socket() 
> and _dbus_connect_tcp_port() which are used in dbus-sysdeps-win.c too, 
> now win32 builds are broken.
I've added a related win32 patch.

 BTW: _dbus_connect_tcp_socket declaration uses *port, but the 
implementation uses port.

Ralf

-------------- next part --------------
--- C:\Dokumente und Einstellungen\Ralf\Lokale Einstellungen\Temp\TCVde1d.tmp\dbus-sysdeps-win.1.3.c	Thu Mar 08 14:40:16 2007
+++ F:\daten\windbus\cvs-commit2\dbus\dbus-sysdeps-win.c	Fri Mar 09 19:30:03 2007
@@ -3447,7 +3447,7 @@
 
 int
 _dbus_listen_tcp_socket (const char     *host,
-                         dbus_uint32_t   port,
+                         dbus_uint32_t  *port,
                          DBusError      *error)
 {
   DBusSocket slisten;
@@ -3455,7 +3455,7 @@
   struct sockaddr_in addr;
   struct hostent *he;
   struct in_addr *haddr;
-  int len =  sizeof (struct sockaddr);
+  socklen_t len = (socklen_t) sizeof (struct sockaddr);
   struct in_addr ina;
 
 
@@ -3504,14 +3504,14 @@
   _DBUS_ZERO (addr);
   memcpy (&addr.sin_addr, haddr, sizeof (struct in_addr));
   addr.sin_family = AF_INET;
-  addr.sin_port = htons (port);
+  addr.sin_port = htons (*port);
 
   if (bind (slisten.fd, (struct sockaddr*) &addr, sizeof (struct sockaddr)))
     {
       DBUS_SOCKET_SET_ERRNO ();
       dbus_set_error (error, _dbus_error_from_errno (errno),
                       "Failed to bind socket \"%s:%d\": %s",
-                      host, port, _dbus_strerror (errno));
+                      host, *port, _dbus_strerror (errno));
       DBUS_CLOSE_SOCKET (slisten.fd);
       return -1;
     }
@@ -3521,13 +3521,14 @@
       DBUS_SOCKET_SET_ERRNO ();
       dbus_set_error (error, _dbus_error_from_errno (errno),
                       "Failed to listen on socket \"%s:%d\": %s",
-                      host, port, _dbus_strerror (errno));
+                      host, *port, _dbus_strerror (errno));
       DBUS_CLOSE_SOCKET (slisten.fd);
       return -1;
     }
 
 
   getsockname(slisten.fd, (struct sockaddr*) &addr, &len);
+  *port = (dbus_uint32_t) ntohs(addr.sin_port);
 
   _dbus_daemon_init(host, ntohs(addr.sin_port));
 


More information about the dbus mailing list