Changeset 341 for trunk/src/sh_forward.c


Ignore:
Timestamp:
May 11, 2011, 9:34:15 PM (14 years ago)
Author:
katerina
Message:

Fix for ticket #250: Compile error if option --enable-udp is used

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sh_forward.c

    r315 r341  
    57745774   * should be no problem as long as  sizeof(struct sockaddr_in) < INT_MAX ...
    57755775   */
    5776   int                fromlen = sizeof(from);
     5776  unsigned int fromlen = sizeof(from);
    57775777
    57785778  if (enable_syslog_socket == S_FALSE)
     
    57915791  res = recvfrom(fd,  buf,  1047, 0, (struct sockaddr *) &from, &fromlen);
    57925792
    5793   sh_ipvx_save(&ss, sa->sa_family, &from);
     5793  sh_ipvx_save(&ss, sa->sa_family, (struct sockaddr *) &from);
    57945794  sh_ipvx_ntoa(namebuf, sizeof(namebuf), &ss);
    57955795
     
    58555855      tmp = sh_tools_safe_name (ptr, 1);
    58565856      sh_error_handle((-1), FIL__, __LINE__, 0, MSG_INET_SYSLOG,
    5857                       my_inet_ntoa(from.sin_addr),
     5857                      namebuf,
    58585858                      (cfac == NULL) ? _("none") : cfac,
    58595859                      (cpri == NULL) ? _("none") : cpri,
     
    59595959  if (callerFlag == S_FALSE)
    59605960    {
    5961       if (enable_syslog_socket == S_FALSE && syslog_sock >= 0)
     5961      if (enable_syslog_socket == S_FALSE && syslog_sock_n > 0)
    59625962        {
    59635963          /* user does not wish to use this facility
    59645964           */
    59655965          TPT(( 0, FIL__, __LINE__, _("msg=<close syslog socket>\n")));
    5966           sl_close_fd(FIL__, __LINE__, syslog_sock);
    5967           syslog_sock[0] = -1;
     5966          for (sock = 0; sock < syslog_sock_n; ++sock)
     5967            {
     5968              sl_close_fd(FIL__, __LINE__, syslog_sock[sock]);
     5969              syslog_sock[0] = -1;
     5970            }
    59685971        }
    59695972      SL_RETURN((-1), _("create_syslog_socket"));
     
    59785981  addr.sin_port        = htons(514);
    59795982 
    5980   do_syslog_socket(AF_INET, SOCK_DGRAM, 0, (struct sockaddr *) &addr, addrlen);
     5983  sock = do_syslog_socket(AF_INET, SOCK_DGRAM, 0,
     5984                          (struct sockaddr *) &addr, addrlen);
    59815985
    59825986  if (sock >= 0) {
     
    59915995  if (getaddrinfo (NULL, "syslog", &hints, &ai) != 0)
    59925996    {
    5993       errnum = errno;
     5997      int errnum = errno;
    59945998      sh_forward_printerr (_("getaddrinfo"), errnum, 514, __LINE__);
    5995       sl_close_fd (FIL__, __LINE__, sock);
    59965999      SL_RETURN((-1), _("create_syslog_socket"));
    59976000    }
     
    60196022    }
    60206023  freeaddrinfo (ai);
    6021 #endif
    60226024
    60236025 end:
     6026#endif
    60246027  if (syslog_sock_n > 1)
    60256028    SH_MINSOCK += (syslog_sock_n - 1);
Note: See TracChangeset for help on using the changeset viewer.