Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
openldap
OpenLDAP
Commits
dc441334
Commit
dc441334
authored
Jul 28, 2002
by
Kurt Zeilenga
Browse files
Fix up restart code for EINTR
parent
c054d845
Changes
3
Hide whitespace changes
Inline
Side-by-side
libraries/libldap/options.c
View file @
dc441334
...
...
@@ -158,16 +158,14 @@ ldap_get_option(
case
LDAP_OPT_TIMEOUT
:
/* the caller has to free outvalue ! */
if
(
ldap_int_timeval_dup
(
outvalue
,
lo
->
ldo_tm_api
)
!=
0
)
{
if
(
ldap_int_timeval_dup
(
outvalue
,
lo
->
ldo_tm_api
)
!=
0
)
{
return
LDAP_OPT_ERROR
;
}
return
LDAP_OPT_SUCCESS
;
case
LDAP_OPT_NETWORK_TIMEOUT
:
/* the caller has to free outvalue ! */
if
(
ldap_int_timeval_dup
(
outvalue
,
lo
->
ldo_tm_net
)
!=
0
)
{
if
(
ldap_int_timeval_dup
(
outvalue
,
lo
->
ldo_tm_net
)
!=
0
)
{
return
LDAP_OPT_ERROR
;
}
return
LDAP_OPT_SUCCESS
;
...
...
libraries/libldap/os-ip.c
View file @
dc441334
...
...
@@ -201,6 +201,7 @@ ldap_pvt_connect(LDAP *ld, ber_socket_t s,
struct
sockaddr
*
sin
,
socklen_t
addrlen
,
int
async
)
{
int
rc
;
struct
timeval
tv
,
*
opt_tv
=
NULL
;
fd_set
wfds
,
*
z
=
NULL
;
#ifdef HAVE_WINSOCK
...
...
@@ -230,8 +231,7 @@ ldap_pvt_connect(LDAP *ld, ber_socket_t s,
if
(
ldap_pvt_ndelay_on
(
ld
,
s
)
==
-
1
)
return
(
-
1
);
if
(
connect
(
s
,
sin
,
addrlen
)
!=
AC_SOCKET_ERROR
)
{
if
(
connect
(
s
,
sin
,
addrlen
)
!=
AC_SOCKET_ERROR
)
{
if
(
ldap_pvt_ndelay_off
(
ld
,
s
)
==
-
1
)
return
(
-
1
);
return
(
0
);
...
...
@@ -257,16 +257,18 @@ ldap_pvt_connect(LDAP *ld, ber_socket_t s,
FD_SET
(
s
,
&
efds
);
#endif
if
(
select
(
ldap_int_tblsize
,
z
,
&
wfds
,
do
{
rc
=
select
(
ldap_int_tblsize
,
z
,
&
wfds
,
#ifdef HAVE_WINSOCK
&
efds
,
&
efds
,
#else
z
,
z
,
#endif
opt_tv
?
&
tv
:
NULL
)
==
AC_SOCKET_ERROR
)
{
return
(
-
1
);
}
opt_tv
?
&
tv
:
NULL
);
}
while
(
rc
==
AC_SOCKET_ERROR
&&
errno
==
EINTR
&&
LDAP_BOOL_GET
(
&
ld
->
ld_options
,
LDAP_BOOL_RESTART
));
if
(
rc
==
AC_SOCKET_ERROR
)
return
rc
;
#ifdef HAVE_WINSOCK
/* This means the connection failed */
...
...
libraries/libldap/os-local.c
View file @
dc441334
...
...
@@ -134,6 +134,7 @@ ldap_pvt_is_socket_ready(LDAP *ld, int s)
static
int
ldap_pvt_connect
(
LDAP
*
ld
,
ber_socket_t
s
,
struct
sockaddr_un
*
sa
,
int
async
)
{
int
rc
;
struct
timeval
tv
,
*
opt_tv
=
NULL
;
fd_set
wfds
,
*
z
=
NULL
;
...
...
@@ -168,11 +169,12 @@ ldap_pvt_connect(LDAP *ld, ber_socket_t s, struct sockaddr_un *sa, int async)
FD_ZERO
(
&
wfds
);
FD_SET
(
s
,
&
wfds
);
if
(
select
(
ldap_int_tblsize
,
z
,
&
wfds
,
z
,
opt_tv
?
&
tv
:
NULL
)
==
AC_SOCKET_ERROR
)
{
return
(
-
1
);
}
do
{
rc
=
select
(
ldap_int_tblsize
,
z
,
&
wfds
,
z
,
opt_tv
?
&
tv
:
NULL
);
}
while
(
rc
==
AC_SOCKET_ERROR
&&
errno
==
EINTR
&&
LDAP_BOOL_GET
(
&
ld
->
ld_options
,
LDAP_BOOL_RESTART
));
if
(
rc
==
AC_SOCKET_ERROR
)
return
rc
;
if
(
FD_ISSET
(
s
,
&
wfds
)
)
{
if
(
ldap_pvt_is_socket_ready
(
ld
,
s
)
==
-
1
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment