Opened 13 years ago

Closed 13 years ago

Last modified 8 years ago

#250 closed defect (fixed)

Compile error if option --enable-udp is used

Reported by: rainer Owned by: rainer
Priority: major Milestone: 2.8.5
Component: main Version:
Keywords: Cc:

Description

As noticed by Sean Chittenden, there's a compile error with the option --with-udp

gcc  -DHAVE_CONFIG_H -I. -I./include   -O2 -D_FORTIFY_SOURCE=2 -fstack-protector-all -fPIE -Wall -W  -fno-strength-reduce -fno-omit-frame-pointer -Wno-empty-body  -DSH_WITH_SERVER -o sh_forward.o -c x_sh_forward.c
x_sh_forward.c: In function ‘recv_syslog_socket’:
x_sh_forward.c:5791: warning: pointer targets in passing argument 6 of ‘recvfrom’ differ in signedness
/usr/include/bits/socket2.h:65: note: expected ‘socklen_t * __restrict__’ but argument is of type ‘int *’
x_sh_forward.c:5793: warning: passing argument 3 of ‘sh_ipvx_save’ from incompatible pointer type
./include/sh_ipvx.h:54: note: expected ‘struct sockaddr *’ but argument is of type ‘struct sockaddr_in *’
x_sh_forward.c:5857: warning: implicit declaration of function ‘my_inet_ntoa’
x_sh_forward.c: In function ‘create_syslog_socket’:
x_sh_forward.c:5961: warning: ordered comparison of pointer with integer zero
x_sh_forward.c:5966: warning: passing argument 3 of ‘sl_close_fd’ makes integer from pointer without a cast
./include/slib.h:402: note: expected ‘int’ but argument is of type ‘int *’
x_sh_forward.c:5993: error: ‘errnum’ undeclared (first use in this function)
x_sh_forward.c:5993: error: (Each undeclared identifier is reported only once
x_sh_forward.c:5993: error: for each function it appears in.)

This is the patch offered by S.Chittenden (contains minor errors in the handling of the syslock_sock array):

@@ -5788,9 +5788,9 @@
return_next = 0;
}

- res = recvfrom(fd, buf, 1047, 0, (struct sockaddr *) &from, &fromlen);
+ res = recvfrom(fd, buf, 1047, 0, (struct sockaddr *) &from, (unsigned int *)&fromlen);

- sh_ipvx_save(&ss, sa->sa_family, &from);
+ sh_ipvx_save(&ss, sa->sa_family, sa);
sh_ipvx_ntoa(namebuf, sizeof(namebuf), &ss);

if (res > 0)
@@ -5854,7 +5854,7 @@
xml special chars (flag == 1) */
tmp = sh_tools_safe_name (ptr, 1);
sh_error_handle((-1), FIL__, __LINE__, 0, MSG_INET_SYSLOG,
- my_inet_ntoa(from.sin_addr),
+ namebuf,
(cfac == NULL) ? _("none") : cfac,
(cpri == NULL) ? _("none") : cpri,
(ptr == NULL) ? _("none") : ptr);
@@ -5958,12 +5958,12 @@

if (callerFlag == S_FALSE)
{
- if (enable_syslog_socket == S_FALSE && syslog_sock >= 0)
+ if (enable_syslog_socket == S_FALSE && syslog_sock[0] >= 0)
{
/* user does not wish to use this facility
*/
TPT(( 0, FIL__, __LINE__, _("msg=<close syslog socket>\n")));
- sl_close_fd(FIL__, __LINE__, syslog_sock);
+ sl_close_fd(FIL__, __LINE__, syslog_sock[0]);
syslog_sock[0] = -1;
}
SL_RETURN((-1), _("create_syslog_socket"));
@@ -5977,7 +5977,7 @@
addr.sin_family = AF_INET;
addr.sin_port = htons(514);

- do_syslog_socket(AF_INET, SOCK_DGRAM, 0, (struct sockaddr *) &addr, addrlen);
+ sock = do_syslog_socket(AF_INET, SOCK_DGRAM, 0, (struct sockaddr *) &addr, addrlen);

if (sock >= 0) {
syslog_sock[0] = sock;
@@ -6020,7 +6020,9 @@
freeaddrinfo (ai);
#endif

+#if defined(USE_IPVX)
end:
+#endif
if (syslog_sock_n > 1)
SH_MINSOCK += (syslog_sock_n - 1);

Change History (1)

comment:1 by rainer, 13 years ago

Resolution: fixed
Status: newclosed

Fixed in changeset [341].

Note: See TracTickets for help on using tickets.