mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-24 00:29:35 -05:00
ITS#5507: Set FD_CLOEXEC (close on exec) flag on LDAP file descriptors
This commit is contained in:
parent
96d5ed5bc5
commit
1fc3f1c130
2 changed files with 12 additions and 0 deletions
|
|
@ -36,6 +36,9 @@
|
|||
#ifdef HAVE_IO_H
|
||||
#include <io.h>
|
||||
#endif /* HAVE_IO_H */
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#include "ldap-int.h"
|
||||
|
||||
|
|
@ -110,6 +113,9 @@ ldap_int_socket(LDAP *ld, int family, int type )
|
|||
{
|
||||
ber_socket_t s = socket(family, type, 0);
|
||||
osip_debug(ld, "ldap_new_socket: %d\n",s,0,0);
|
||||
#ifdef FD_CLOEXEC
|
||||
fcntl(s, F_SETFD, FD_CLOEXEC);
|
||||
#endif
|
||||
return ( s );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,9 @@
|
|||
#ifdef HAVE_IO_H
|
||||
#include <io.h>
|
||||
#endif /* HAVE_IO_H */
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#include "ldap-int.h"
|
||||
#include "ldap_defaults.h"
|
||||
|
|
@ -89,6 +92,9 @@ ldap_pvt_socket(LDAP *ld)
|
|||
{
|
||||
ber_socket_t s = socket(PF_LOCAL, SOCK_STREAM, 0);
|
||||
oslocal_debug(ld, "ldap_new_socket: %d\n",s,0,0);
|
||||
#ifdef FD_CLOEXEC
|
||||
fcntl(s, F_SETFD, FD_CLOEXEC);
|
||||
#endif
|
||||
return ( s );
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue