Ignore:
Timestamp:
Oct 23, 2007, 11:44:41 PM (17 years ago)
Author:
rainer
Message:

Make utility functions thread-safe.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sh_portcheck.c

    r131 r132  
    608608  int                nerr;
    609609#endif
     610  char errbuf[SH_ERRBUF_SIZE];
    610611
    611612  /* inet_aton(interface, &haddr); */
     
    627628      nerr = errno;
    628629      sl_snprintf(errmsg, sizeof(errmsg), _("check port: %5d/udp on %15s: %s"),
    629                   port, inet_ntoa(haddr), sh_error_message(errno));
     630                  port, inet_ntoa(haddr), sh_error_message(errno, errbuf, sizeof(errbuf)));
    630631      sh_error_handle((-1), FIL__, __LINE__, nerr, MSG_E_SUBGEN,
    631632                      errmsg, _("connect"));
     
    693694  int                nerr;
    694695#endif
    695 
     696  char errbuf[SH_ERRBUF_SIZE];
    696697
    697698  /* inet_aton(interface, &haddr); */
     
    719720      nerr = errno;
    720721      sl_snprintf(errmsg, sizeof(errmsg), _("check port: %5d/tcp on %15s: %s"),
    721                   port, inet_ntoa(haddr), sh_error_message(errno));
     722                  port, inet_ntoa(haddr), sh_error_message(errno, errbuf, sizeof(errbuf)));
    722723      sh_error_handle((-1), FIL__, __LINE__, nerr, MSG_E_SUBGEN,
    723724                      errmsg, _("connect"));
     
    889890  int              flag =  1; /* non-zero to enable an option */
    890891  struct in_addr   haddr;
    891  
     892  char errbuf[SH_ERRBUF_SIZE];
     893
    892894  /* Check all interfaces for this host
    893895   */
     
    901903#else
    902904          sh_error_handle((-1), FIL__, __LINE__, errno, MSG_E_SUBGEN,
    903                           sh_error_message(errno), _("socket"));
     905                          sh_error_message(errno, errbuf, sizeof(errbuf)), _("socket"));
    904906#endif
    905907        }
     
    912914#else
    913915          sh_error_handle((-1), FIL__, __LINE__, errno, MSG_E_SUBGEN,
    914                           sh_error_message(errno), _("setsockopt"));
     916                          sh_error_message(errno, errbuf, sizeof(errbuf)),_("setsockopt"));
    915917#endif
    916918        }
     
    957959  struct sockaddr_in addr;
    958960  int addrlen      = sizeof(addr);
     961  char errbuf[SH_ERRBUF_SIZE];
    959962
    960963  if (min_port == -1)
     
    973976#else
    974977          sh_error_handle((-1), FIL__, __LINE__, errno, MSG_E_SUBGEN,
    975                           sh_error_message(errno), _("socket"));
     978                          sh_error_message(errno, errbuf, sizeof(errbuf)), _("socket"));
    976979#endif
    977980        }
     
    984987#else
    985988          sh_error_handle((-1), FIL__, __LINE__, errno, MSG_E_SUBGEN,
    986                           sh_error_message(errno), _("setsockopt"));
     989                          sh_error_message(errno, errbuf, sizeof(errbuf)),_("setsockopt"));
    987990#endif
    988991        }
     
    10181021#else
    10191022              sh_error_handle((-1), FIL__, __LINE__, errno, MSG_E_SUBGEN,
    1020                               sh_error_message(errno), _("bind"));
     1023                              sh_error_message(errno, errbuf, sizeof(errbuf)), _("bind"));
    10211024#endif
    10221025            }
Note: See TracChangeset for help on using the changeset viewer.