AC_MSG_ERROR([YAZ development libraries missing])
fi
YAZ_DOC
-AC_CHECK_HEADERS([unistd.h sys/stat.h sys/time.h sys/types.h])
+AC_CHECK_HEADERS([unistd.h sys/stat.h sys/time.h sys/types.h fcntl.h])
AC_ARG_ENABLE(zoom,[ --disable-zoom disable ZOOM (for old C++ compilers)],[enable_zoom=$enableval],[enable_zoom=yes])
AM_CONDITIONAL(ZOOM, test $enable_zoom = "yes")
#include <yazpp/pdu-assoc.h>
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
using namespace yazpp_1;
void PDU_Assoc::init(ISocketObservable *socketObservable)
return -1;
if (cs_bind(m_cs, ap, CS_SERVER) < 0)
return -2;
- m_socketObservable->addObserver(cs_fileno(m_cs), this);
+
+ int fd = cs_fileno(m_cs);
+#if HAVE_FCNTL_H
+ int oldflags = fcntl(fd, F_GETFD, 0);
+ if (oldflags >= 0)
+ {
+ oldflags |= FD_CLOEXEC;
+ fcntl(fd, F_SETFD, oldflags);
+ }
+#endif
+ m_socketObservable->addObserver(fd, this);
yaz_log(m_log, "maskObserver 9");
m_socketObservable->maskObserver(this, SOCKET_OBSERVE_READ|
SOCKET_OBSERVE_EXCEPT);
- yaz_log (m_log, "PDU_Assoc::listen ok fd=%d", cs_fileno(m_cs));
+ yaz_log (m_log, "PDU_Assoc::listen ok fd=%d", fd);
m_state = Listen;
return 0;
}