projects
/
yazpp-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/yazpp
[yazpp-moved-to-github.git]
/
src
/
yaz-pdu-assoc.cpp
diff --git
a/src/yaz-pdu-assoc.cpp
b/src/yaz-pdu-assoc.cpp
index
3ff759f
..
2d17f11
100644
(file)
--- a/
src/yaz-pdu-assoc.cpp
+++ b/
src/yaz-pdu-assoc.cpp
@@
-1,5
+1,5
@@
/* This file is part of the yazpp toolkit.
/* This file is part of the yazpp toolkit.
- * Copyright (C) 1998-2009 Index Data and Mike Taylor
+ * Copyright (C) 1998-2011 Index Data and Mike Taylor
* See the file LICENSE for details.
*/
* See the file LICENSE for details.
*/
@@
-10,6
+10,10
@@
#include <yazpp/pdu-assoc.h>
#include <yazpp/pdu-assoc.h>
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
using namespace yazpp_1;
void PDU_Assoc::init(ISocketObservable *socketObservable)
using namespace yazpp_1;
void PDU_Assoc::init(ISocketObservable *socketObservable)
@@
-425,11
+429,21
@@
int PDU_Assoc::listen(IPDU_Observer *observer, const char *addr)
return -1;
if (cs_bind(m_cs, ap, CS_SERVER) < 0)
return -2;
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, "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;
}
m_state = Listen;
return 0;
}
@@
-516,6
+530,7
@@
const char*PDU_Assoc::getpeername()
/*
* Local variables:
* c-basic-offset: 4
/*
* Local variables:
* c-basic-offset: 4
+ * c-file-style: "Stroustrup"
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab