[Pidgin] #17156: getsockname: Windows socket error #10014

Pidgin trac at pidgin.im
Sat Feb 10 08:28:02 EST 2018


#17156: getsockname: Windows socket error #10014
----------------------+------------------------------
 Reporter:  roti_343  |       Owner:  datallah
     Type:  defect    |      Status:  new
Milestone:            |   Component:  winpidgin (gtk)
  Version:  2.11.0    |  Resolution:
 Keywords:            |
----------------------+------------------------------

Comment (by stefanb):

 A proposed fix would be:


 {{{
 unsigned short
 purple_network_get_port_from_fd(int fd)
 {
         struct sockaddr_in *addr;
         socklen_t len;
         unsigned short port = 0; /* default on error */

         g_return_val_if_fail(fd >= 0, 0);

         addr = g_new(struct sockaddr_in, 1);
         len = sizeof(struct sockaddr_in);
         if (getsockname(fd, (struct sockaddr *) addr, &len) == -1) {
                 purple_debug_warning("network", "getsockname: %s\n",
 g_strerror(errno));
         } else {
                 port = ntohs(addr->sin_port);
         }
         g_free(addr);

         return port;
 }

 }}}

--
Ticket URL: <https://developer.pidgin.im/ticket/17156#comment:2>
Pidgin <https://pidgin.im>
Pidgin


More information about the Tracker mailing list