mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-26 22:30:28 +00:00
OS X does not define MSG_NOSIGNAL, but it does have a socket option SO_NOSIGPIPE.
(closes issue #16178) Reported by: oej git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@232950 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
162
configure
vendored
162
configure
vendored
@@ -1,5 +1,5 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# From configure.ac Revision: 227580 .
|
# From configure.ac Revision: 232164 .
|
||||||
# Guess values for system-dependent variables and create Makefiles.
|
# Guess values for system-dependent variables and create Makefiles.
|
||||||
# Generated by GNU Autoconf 2.61 for asterisk 1.6.
|
# Generated by GNU Autoconf 2.61 for asterisk 1.6.
|
||||||
#
|
#
|
||||||
@@ -1076,6 +1076,8 @@ CONFIG_GMIME
|
|||||||
EDITLINE_LIB
|
EDITLINE_LIB
|
||||||
PBX_H323
|
PBX_H323
|
||||||
PBX_IXJUSER
|
PBX_IXJUSER
|
||||||
|
PBX_MSG_NOSIGNAL
|
||||||
|
PBX_SO_NOSIGPIPE
|
||||||
CONFIG_SDL
|
CONFIG_SDL
|
||||||
CONFIG_GTK
|
CONFIG_GTK
|
||||||
PKGCONFIG
|
PKGCONFIG
|
||||||
@@ -43333,6 +43335,160 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Used in res/res_pktccops
|
||||||
|
|
||||||
|
if test "x${PBX_MSG_NOSIGNAL}" != "x1"; then
|
||||||
|
{ echo "$as_me:$LINENO: checking for MSG_NOSIGNAL in sys/socket.h" >&5
|
||||||
|
echo $ECHO_N "checking for MSG_NOSIGNAL in sys/socket.h... $ECHO_C" >&6; }
|
||||||
|
saved_cppflags="${CPPFLAGS}"
|
||||||
|
if test "x${MSG_NOSIGNAL_DIR}" != "x"; then
|
||||||
|
MSG_NOSIGNAL_INCLUDE="-I${MSG_NOSIGNAL_DIR}/include"
|
||||||
|
fi
|
||||||
|
CPPFLAGS="${CPPFLAGS} ${MSG_NOSIGNAL_INCLUDE}"
|
||||||
|
|
||||||
|
cat >conftest.$ac_ext <<_ACEOF
|
||||||
|
/* confdefs.h. */
|
||||||
|
_ACEOF
|
||||||
|
cat confdefs.h >>conftest.$ac_ext
|
||||||
|
cat >>conftest.$ac_ext <<_ACEOF
|
||||||
|
/* end confdefs.h. */
|
||||||
|
#include <sys/socket.h>
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
#if defined(MSG_NOSIGNAL)
|
||||||
|
int foo = 0;
|
||||||
|
#else
|
||||||
|
int foo = bar;
|
||||||
|
#endif
|
||||||
|
0
|
||||||
|
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
rm -f conftest.$ac_objext
|
||||||
|
if { (ac_try="$ac_compile"
|
||||||
|
case "(($ac_try" in
|
||||||
|
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||||
|
*) ac_try_echo=$ac_try;;
|
||||||
|
esac
|
||||||
|
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||||
|
(eval "$ac_compile") 2>conftest.er1
|
||||||
|
ac_status=$?
|
||||||
|
grep -v '^ *+' conftest.er1 >conftest.err
|
||||||
|
rm -f conftest.er1
|
||||||
|
cat conftest.err >&5
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); } && {
|
||||||
|
test -z "$ac_c_werror_flag" ||
|
||||||
|
test ! -s conftest.err
|
||||||
|
} && test -s conftest.$ac_objext; then
|
||||||
|
{ echo "$as_me:$LINENO: result: yes" >&5
|
||||||
|
echo "${ECHO_T}yes" >&6; }
|
||||||
|
PBX_MSG_NOSIGNAL=1
|
||||||
|
|
||||||
|
cat >>confdefs.h <<\_ACEOF
|
||||||
|
#define HAVE_MSG_NOSIGNAL 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
|
||||||
|
cat >>confdefs.h <<\_ACEOF
|
||||||
|
#define HAVE_MSG_NOSIGNAL_VERSION
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "$as_me: failed program was:" >&5
|
||||||
|
sed 's/^/| /' conftest.$ac_ext >&5
|
||||||
|
|
||||||
|
{ echo "$as_me:$LINENO: result: no" >&5
|
||||||
|
echo "${ECHO_T}no" >&6; }
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||||
|
CPPFLAGS="${saved_cppflags}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if test "x${PBX_SO_NOSIGPIPE}" != "x1"; then
|
||||||
|
{ echo "$as_me:$LINENO: checking for SO_NOSIGPIPE in sys/socket.h" >&5
|
||||||
|
echo $ECHO_N "checking for SO_NOSIGPIPE in sys/socket.h... $ECHO_C" >&6; }
|
||||||
|
saved_cppflags="${CPPFLAGS}"
|
||||||
|
if test "x${SO_NOSIGPIPE_DIR}" != "x"; then
|
||||||
|
SO_NOSIGPIPE_INCLUDE="-I${SO_NOSIGPIPE_DIR}/include"
|
||||||
|
fi
|
||||||
|
CPPFLAGS="${CPPFLAGS} ${SO_NOSIGPIPE_INCLUDE}"
|
||||||
|
|
||||||
|
cat >conftest.$ac_ext <<_ACEOF
|
||||||
|
/* confdefs.h. */
|
||||||
|
_ACEOF
|
||||||
|
cat confdefs.h >>conftest.$ac_ext
|
||||||
|
cat >>conftest.$ac_ext <<_ACEOF
|
||||||
|
/* end confdefs.h. */
|
||||||
|
#include <sys/socket.h>
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
#if defined(SO_NOSIGPIPE)
|
||||||
|
int foo = 0;
|
||||||
|
#else
|
||||||
|
int foo = bar;
|
||||||
|
#endif
|
||||||
|
0
|
||||||
|
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
rm -f conftest.$ac_objext
|
||||||
|
if { (ac_try="$ac_compile"
|
||||||
|
case "(($ac_try" in
|
||||||
|
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||||
|
*) ac_try_echo=$ac_try;;
|
||||||
|
esac
|
||||||
|
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||||
|
(eval "$ac_compile") 2>conftest.er1
|
||||||
|
ac_status=$?
|
||||||
|
grep -v '^ *+' conftest.er1 >conftest.err
|
||||||
|
rm -f conftest.er1
|
||||||
|
cat conftest.err >&5
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); } && {
|
||||||
|
test -z "$ac_c_werror_flag" ||
|
||||||
|
test ! -s conftest.err
|
||||||
|
} && test -s conftest.$ac_objext; then
|
||||||
|
{ echo "$as_me:$LINENO: result: yes" >&5
|
||||||
|
echo "${ECHO_T}yes" >&6; }
|
||||||
|
PBX_SO_NOSIGPIPE=1
|
||||||
|
|
||||||
|
cat >>confdefs.h <<\_ACEOF
|
||||||
|
#define HAVE_SO_NOSIGPIPE 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
|
||||||
|
cat >>confdefs.h <<\_ACEOF
|
||||||
|
#define HAVE_SO_NOSIGPIPE_VERSION
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "$as_me: failed program was:" >&5
|
||||||
|
sed 's/^/| /' conftest.$ac_ext >&5
|
||||||
|
|
||||||
|
{ echo "$as_me:$LINENO: result: no" >&5
|
||||||
|
echo "${ECHO_T}no" >&6; }
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||||
|
CPPFLAGS="${saved_cppflags}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if test "x${PBX_SDL}" != "x1" -a "${USE_SDL}" != "no"; then
|
if test "x${PBX_SDL}" != "x1" -a "${USE_SDL}" != "no"; then
|
||||||
PBX_SDL=0
|
PBX_SDL=0
|
||||||
@@ -47636,6 +47792,8 @@ CONFIG_GMIME!$CONFIG_GMIME$ac_delim
|
|||||||
EDITLINE_LIB!$EDITLINE_LIB$ac_delim
|
EDITLINE_LIB!$EDITLINE_LIB$ac_delim
|
||||||
PBX_H323!$PBX_H323$ac_delim
|
PBX_H323!$PBX_H323$ac_delim
|
||||||
PBX_IXJUSER!$PBX_IXJUSER$ac_delim
|
PBX_IXJUSER!$PBX_IXJUSER$ac_delim
|
||||||
|
PBX_MSG_NOSIGNAL!$PBX_MSG_NOSIGNAL$ac_delim
|
||||||
|
PBX_SO_NOSIGPIPE!$PBX_SO_NOSIGPIPE$ac_delim
|
||||||
CONFIG_SDL!$CONFIG_SDL$ac_delim
|
CONFIG_SDL!$CONFIG_SDL$ac_delim
|
||||||
CONFIG_GTK!$CONFIG_GTK$ac_delim
|
CONFIG_GTK!$CONFIG_GTK$ac_delim
|
||||||
PKGCONFIG!$PKGCONFIG$ac_delim
|
PKGCONFIG!$PKGCONFIG$ac_delim
|
||||||
@@ -47658,7 +47816,7 @@ PBX_SYSLOG!$PBX_SYSLOG$ac_delim
|
|||||||
LTLIBOBJS!$LTLIBOBJS$ac_delim
|
LTLIBOBJS!$LTLIBOBJS$ac_delim
|
||||||
_ACEOF
|
_ACEOF
|
||||||
|
|
||||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 89; then
|
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 91; then
|
||||||
break
|
break
|
||||||
elif $ac_last_try; then
|
elif $ac_last_try; then
|
||||||
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
|
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
|
||||||
|
|||||||
@@ -1706,6 +1706,10 @@ AC_CHECK_HEADER([linux/ixjuser.h], [PBX_IXJUSER=1], [PBX_IXJUSER=0], [
|
|||||||
])
|
])
|
||||||
AC_SUBST(PBX_IXJUSER)
|
AC_SUBST(PBX_IXJUSER)
|
||||||
|
|
||||||
|
# Used in res/res_pktccops
|
||||||
|
AST_C_DEFINE_CHECK([MSG_NOSIGNAL], [MSG_NOSIGNAL], [sys/socket.h])
|
||||||
|
AST_C_DEFINE_CHECK([SO_NOSIGPIPE], [SO_NOSIGPIPE], [sys/socket.h])
|
||||||
|
|
||||||
AST_EXT_TOOL_CHECK([SDL], [sdl-config])
|
AST_EXT_TOOL_CHECK([SDL], [sdl-config])
|
||||||
AST_EXT_LIB_CHECK([SDL_IMAGE], [SDL_image], [IMG_Load], [SDL_image.h], [${SDL_LIB}], [${SDL_INCLUDE}])
|
AST_EXT_LIB_CHECK([SDL_IMAGE], [SDL_image], [IMG_Load], [SDL_image.h], [${SDL_LIB}], [${SDL_INCLUDE}])
|
||||||
AST_EXT_LIB_CHECK([FFMPEG], [avcodec], [sws_getContext], [ffmpeg/avcodec.h], [-lpthread -lz -lm])
|
AST_EXT_LIB_CHECK([FFMPEG], [avcodec], [sws_getContext], [ffmpeg/avcodec.h], [-lpthread -lz -lm])
|
||||||
|
|||||||
@@ -534,6 +534,12 @@
|
|||||||
/* Define to 1 if you have a working `mmap' system call. */
|
/* Define to 1 if you have a working `mmap' system call. */
|
||||||
#undef HAVE_MMAP
|
#undef HAVE_MMAP
|
||||||
|
|
||||||
|
/* Define if your system has the MSG_NOSIGNAL headers. */
|
||||||
|
#undef HAVE_MSG_NOSIGNAL
|
||||||
|
|
||||||
|
/* Define MSG_NOSIGNAL headers version */
|
||||||
|
#undef HAVE_MSG_NOSIGNAL_VERSION
|
||||||
|
|
||||||
/* Define to 1 if you have the `munmap' function. */
|
/* Define to 1 if you have the `munmap' function. */
|
||||||
#undef HAVE_MUNMAP
|
#undef HAVE_MUNMAP
|
||||||
|
|
||||||
@@ -810,6 +816,12 @@
|
|||||||
/* Define to 1 if your system has soxmix application. */
|
/* Define to 1 if your system has soxmix application. */
|
||||||
#undef HAVE_SOXMIX
|
#undef HAVE_SOXMIX
|
||||||
|
|
||||||
|
/* Define if your system has the SO_NOSIGPIPE headers. */
|
||||||
|
#undef HAVE_SO_NOSIGPIPE
|
||||||
|
|
||||||
|
/* Define SO_NOSIGPIPE headers version */
|
||||||
|
#undef HAVE_SO_NOSIGPIPE_VERSION
|
||||||
|
|
||||||
/* Define if your system has the SPANDSP headers. */
|
/* Define if your system has the SPANDSP headers. */
|
||||||
#undef HAVE_SPANDSP
|
#undef HAVE_SPANDSP
|
||||||
|
|
||||||
|
|||||||
@@ -378,7 +378,7 @@ static int cops_getmsg (int sfd, struct copsmsg *recmsg)
|
|||||||
static int cops_sendmsg (int sfd, struct copsmsg * sendmsg)
|
static int cops_sendmsg (int sfd, struct copsmsg * sendmsg)
|
||||||
{
|
{
|
||||||
char *buf;
|
char *buf;
|
||||||
int bufpos;
|
int bufpos, res;
|
||||||
struct pktcobj *pobject;
|
struct pktcobj *pobject;
|
||||||
|
|
||||||
if (sfd < 0) {
|
if (sfd < 0) {
|
||||||
@@ -425,11 +425,17 @@ static int cops_sendmsg (int sfd, struct copsmsg * sendmsg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
if (send(sfd, buf, sendmsg->length, MSG_NOSIGNAL | MSG_DONTWAIT ) == -1) {
|
#ifdef HAVE_MSG_NOSIGNAL
|
||||||
|
#define SENDFLAGS MSG_NOSIGNAL | MSG_DONTWAIT
|
||||||
|
#else
|
||||||
|
#define SENDFLAGS MSG_DONTWAIT
|
||||||
|
#endif
|
||||||
|
if (send(sfd, buf, sendmsg->length, SENDFLAGS) == -1) {
|
||||||
ast_log(LOG_WARNING, "COPS: Send failed errno=%i\n", errno);
|
ast_log(LOG_WARNING, "COPS: Send failed errno=%i\n", errno);
|
||||||
free(buf);
|
free(buf);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
#undef SENDFLAGS
|
||||||
free(buf);
|
free(buf);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -636,6 +642,9 @@ static int cops_connect(char *host, char *port)
|
|||||||
struct addrinfo hints;
|
struct addrinfo hints;
|
||||||
struct addrinfo *rp;
|
struct addrinfo *rp;
|
||||||
struct addrinfo *result;
|
struct addrinfo *result;
|
||||||
|
#ifdef HAVE_SO_NOSIGPIPE
|
||||||
|
int trueval = 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
memset(&hints, 0, sizeof(struct addrinfo));
|
memset(&hints, 0, sizeof(struct addrinfo));
|
||||||
|
|
||||||
@@ -657,6 +666,9 @@ static int cops_connect(char *host, char *port)
|
|||||||
}
|
}
|
||||||
flags = fcntl(sfd, F_GETFL);
|
flags = fcntl(sfd, F_GETFL);
|
||||||
fcntl(sfd, F_SETFL, flags | O_NONBLOCK);
|
fcntl(sfd, F_SETFL, flags | O_NONBLOCK);
|
||||||
|
#ifdef HAVE_SO_NOSIGPIPE
|
||||||
|
setsockopt(sfd, SO_SOCKET, SO_NOSIGPIPE, &trueval, sizeof(trueval));
|
||||||
|
#endif
|
||||||
connect(sfd, rp->ai_addr, rp->ai_addrlen);
|
connect(sfd, rp->ai_addr, rp->ai_addrlen);
|
||||||
if (sfd == -1) {
|
if (sfd == -1) {
|
||||||
ast_log(LOG_WARNING, "Failed connect\n");
|
ast_log(LOG_WARNING, "Failed connect\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user