mirror of git://anongit.mindrot.org/openssh.git
- markus@cvs.openbsd.org 2001/07/17 20:48:42
[ssh-agent.c] update maxfd if maxfd is closed; report from jmcelroy@dtgnet.com
This commit is contained in:
parent
a7fc2f7434
commit
a3d5a4c2db
|
@ -12,6 +12,9 @@
|
||||||
- stevesk@cvs.openbsd.org 2001/07/15 16:58:29
|
- stevesk@cvs.openbsd.org 2001/07/15 16:58:29
|
||||||
[ssh-agent.c]
|
[ssh-agent.c]
|
||||||
typo in usage; ok markus@
|
typo in usage; ok markus@
|
||||||
|
- markus@cvs.openbsd.org 2001/07/17 20:48:42
|
||||||
|
[ssh-agent.c]
|
||||||
|
update maxfd if maxfd is closed; report from jmcelroy@dtgnet.com
|
||||||
|
|
||||||
20010715
|
20010715
|
||||||
- (bal) Set "BROKEN_GETADDRINFO" for darwin platform. Reported by
|
- (bal) Set "BROKEN_GETADDRINFO" for darwin platform. Reported by
|
||||||
|
@ -6051,4 +6054,4 @@
|
||||||
- Wrote replacements for strlcpy and mkdtemp
|
- Wrote replacements for strlcpy and mkdtemp
|
||||||
- Released 1.0pre1
|
- Released 1.0pre1
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.1407 2001/07/18 15:53:39 mouring Exp $
|
$Id: ChangeLog,v 1.1408 2001/07/18 15:58:08 mouring Exp $
|
||||||
|
|
19
ssh-agent.c
19
ssh-agent.c
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: ssh-agent.c,v 1.65 2001/07/15 16:58:29 stevesk Exp $ */
|
/* $OpenBSD: ssh-agent.c,v 1.66 2001/07/17 20:48:42 markus Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: ssh-agent.c,v 1.65 2001/07/15 16:58:29 stevesk Exp $");
|
RCSID("$OpenBSD: ssh-agent.c,v 1.66 2001/07/17 20:48:42 markus Exp $");
|
||||||
|
|
||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
#include <openssl/md5.h>
|
#include <openssl/md5.h>
|
||||||
|
@ -656,7 +656,7 @@ new_socket(int type, int fd)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
prepare_select(fd_set **fdrp, fd_set **fdwp, int *fdl)
|
prepare_select(fd_set **fdrp, fd_set **fdwp, int *fdl, int *nallocp)
|
||||||
{
|
{
|
||||||
u_int i, sz;
|
u_int i, sz;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
@ -676,15 +676,18 @@ prepare_select(fd_set **fdrp, fd_set **fdwp, int *fdl)
|
||||||
}
|
}
|
||||||
|
|
||||||
sz = howmany(n+1, NFDBITS) * sizeof(fd_mask);
|
sz = howmany(n+1, NFDBITS) * sizeof(fd_mask);
|
||||||
if (*fdrp == NULL || n > *fdl) {
|
if (*fdrp == NULL || sz > *nallocp) {
|
||||||
if (*fdrp)
|
if (*fdrp)
|
||||||
xfree(*fdrp);
|
xfree(*fdrp);
|
||||||
if (*fdwp)
|
if (*fdwp)
|
||||||
xfree(*fdwp);
|
xfree(*fdwp);
|
||||||
*fdrp = xmalloc(sz);
|
*fdrp = xmalloc(sz);
|
||||||
*fdwp = xmalloc(sz);
|
*fdwp = xmalloc(sz);
|
||||||
*fdl = n;
|
*nallocp = sz;
|
||||||
}
|
}
|
||||||
|
if (n < *fdl)
|
||||||
|
debug("XXX shrink: %d < %d", n, *fdl);
|
||||||
|
*fdl = n;
|
||||||
memset(*fdrp, 0, sz);
|
memset(*fdrp, 0, sz);
|
||||||
memset(*fdwp, 0, sz);
|
memset(*fdwp, 0, sz);
|
||||||
|
|
||||||
|
@ -824,7 +827,7 @@ usage(void)
|
||||||
int
|
int
|
||||||
main(int ac, char **av)
|
main(int ac, char **av)
|
||||||
{
|
{
|
||||||
int sock, c_flag = 0, d_flag = 0, k_flag = 0, s_flag = 0, ch;
|
int sock, c_flag = 0, d_flag = 0, k_flag = 0, s_flag = 0, ch, nalloc;
|
||||||
struct sockaddr_un sunaddr;
|
struct sockaddr_un sunaddr;
|
||||||
#ifdef HAVE_SETRLIMIT
|
#ifdef HAVE_SETRLIMIT
|
||||||
struct rlimit rlim;
|
struct rlimit rlim;
|
||||||
|
@ -1017,8 +1020,10 @@ skip:
|
||||||
signal(SIGPIPE, SIG_IGN);
|
signal(SIGPIPE, SIG_IGN);
|
||||||
signal(SIGHUP, cleanup_handler);
|
signal(SIGHUP, cleanup_handler);
|
||||||
signal(SIGTERM, cleanup_handler);
|
signal(SIGTERM, cleanup_handler);
|
||||||
|
nalloc = 0;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
prepare_select(&readsetp, &writesetp, &max_fd);
|
prepare_select(&readsetp, &writesetp, &max_fd, &nalloc);
|
||||||
if (select(max_fd + 1, readsetp, writesetp, NULL, NULL) < 0) {
|
if (select(max_fd + 1, readsetp, writesetp, NULL, NULL) < 0) {
|
||||||
if (errno == EINTR)
|
if (errno == EINTR)
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue