mirror of git://sourceware.org/git/glibc.git
* nis/nis_callback.c (internal_nis_do_callback): Don't use malloc
to allocate memory for my_pollfd. Better initialization of cb_is_running. Use TEMP_FAILURE_RETRY.
This commit is contained in:
parent
f50fa10c8a
commit
101cc59887
|
|
@ -1,5 +1,9 @@
|
||||||
2006-05-19 Ulrich Drepper <drepper@redhat.com>
|
2006-05-19 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* nis/nis_callback.c (internal_nis_do_callback): Don't use malloc
|
||||||
|
to allocate memory for my_pollfd. Better initialization of
|
||||||
|
cb_is_running. Use TEMP_FAILURE_RETRY.
|
||||||
|
|
||||||
* malloc/memusage.sh (memusageso): Add quotes.
|
* malloc/memusage.sh (memusageso): Add quotes.
|
||||||
(memusagestat): Likewise.
|
(memusagestat): Likewise.
|
||||||
* debug/xtrace.sh (pcprofileso): Likewise.
|
* debug/xtrace.sh (pcprofileso): Likewise.
|
||||||
|
|
|
||||||
|
|
@ -197,22 +197,18 @@ internal_nis_do_callback (struct dir_binding *bptr, netobj *cookie,
|
||||||
struct nis_cb *cb)
|
struct nis_cb *cb)
|
||||||
{
|
{
|
||||||
struct timeval TIMEOUT = {25, 0};
|
struct timeval TIMEOUT = {25, 0};
|
||||||
bool_t cb_is_running = FALSE;
|
bool_t cb_is_running;
|
||||||
|
|
||||||
data = cb;
|
data = cb;
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
struct pollfd *my_pollfd;
|
struct pollfd my_pollfd[svc_max_pollfd];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (svc_max_pollfd == 0 && svc_pollfd == NULL)
|
if (svc_max_pollfd == 0 && svc_pollfd == NULL)
|
||||||
return NIS_CBERROR;
|
return NIS_CBERROR;
|
||||||
|
|
||||||
my_pollfd = malloc (sizeof (struct pollfd) * svc_max_pollfd);
|
|
||||||
if (__builtin_expect (my_pollfd == NULL, 0))
|
|
||||||
return NIS_NOMEMORY;
|
|
||||||
|
|
||||||
for (i = 0; i < svc_max_pollfd; ++i)
|
for (i = 0; i < svc_max_pollfd; ++i)
|
||||||
{
|
{
|
||||||
my_pollfd[i].fd = svc_pollfd[i].fd;
|
my_pollfd[i].fd = svc_pollfd[i].fd;
|
||||||
|
|
@ -220,20 +216,17 @@ internal_nis_do_callback (struct dir_binding *bptr, netobj *cookie,
|
||||||
my_pollfd[i].revents = 0;
|
my_pollfd[i].revents = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (i = __poll (my_pollfd, svc_max_pollfd, 25*1000))
|
switch (i = TEMP_FAILURE_RETRY (__poll (my_pollfd, svc_max_pollfd,
|
||||||
|
25*1000)))
|
||||||
{
|
{
|
||||||
case -1:
|
case -1:
|
||||||
free (my_pollfd);
|
|
||||||
if (errno == EINTR)
|
|
||||||
continue;
|
|
||||||
return NIS_CBERROR;
|
return NIS_CBERROR;
|
||||||
case 0:
|
case 0:
|
||||||
free (my_pollfd);
|
|
||||||
/* See if callback 'thread' in the server is still alive. */
|
/* See if callback 'thread' in the server is still alive. */
|
||||||
memset ((char *) &cb_is_running, 0, sizeof (cb_is_running));
|
cb_is_running = FALSE;
|
||||||
if (clnt_call (bptr->clnt, NIS_CALLBACK, (xdrproc_t) xdr_netobj,
|
if (clnt_call (bptr->clnt, NIS_CALLBACK, (xdrproc_t) xdr_netobj,
|
||||||
(caddr_t) cookie, (xdrproc_t) xdr_bool,
|
(caddr_t) cookie, (xdrproc_t) xdr_bool,
|
||||||
(caddr_t) & cb_is_running, TIMEOUT) != RPC_SUCCESS)
|
(caddr_t) &cb_is_running, TIMEOUT) != RPC_SUCCESS)
|
||||||
cb_is_running = FALSE;
|
cb_is_running = FALSE;
|
||||||
|
|
||||||
if (cb_is_running == FALSE)
|
if (cb_is_running == FALSE)
|
||||||
|
|
@ -244,7 +237,6 @@ internal_nis_do_callback (struct dir_binding *bptr, netobj *cookie,
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
svc_getreq_poll (my_pollfd, i);
|
svc_getreq_poll (my_pollfd, i);
|
||||||
free (my_pollfd);
|
|
||||||
if (data->nomore)
|
if (data->nomore)
|
||||||
return data->result;
|
return data->result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue