From 48e7fe1c598ea71e0201d342fdfbd66aed5f3b76 Mon Sep 17 00:00:00 2001 From: joerg Date: Fri, 22 Jan 2010 13:22:28 +0000 Subject: fetch-1.7: Use connection cache (one per host, up to 16 hosts). Rename some parameters to avoid shadowing a global variable. --- net/fetch/Makefile | 5 ++--- net/fetch/files/fetch.c | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-) (limited to 'net') diff --git a/net/fetch/Makefile b/net/fetch/Makefile index 96db34d5927..d34d06e2424 100644 --- a/net/fetch/Makefile +++ b/net/fetch/Makefile @@ -1,8 +1,7 @@ -# $NetBSD: Makefile,v 1.11 2010/01/17 12:02:31 wiz Exp $ +# $NetBSD: Makefile,v 1.12 2010/01/22 13:22:28 joerg Exp $ # -DISTNAME= fetch-1.6 -PKGREVISION= 1 +DISTNAME= fetch-1.7 CATEGORIES= net MASTER_SITES= # empty DISTFILES= # empty diff --git a/net/fetch/files/fetch.c b/net/fetch/files/fetch.c index 6222414a46f..d29b188985c 100644 --- a/net/fetch/files/fetch.c +++ b/net/fetch/files/fetch.c @@ -304,7 +304,7 @@ stat_end(struct xferstat *xs) #if HAVE_TERMIOS_H && !defined(PREFER_GETPASS) static int -read_password(const char *prompt, char *buf, size_t buf_len) +read_password(const char *prompt, char *pwbuf, size_t pwbuf_len) { struct termios tios; tcflag_t saved_flags; @@ -312,13 +312,13 @@ read_password(const char *prompt, char *buf, size_t buf_len) fprintf(stderr, prompt); if (tcgetattr(STDIN_FILENO, &tios) != 0) - return (fgets(buf, buf_len, stdin) == NULL); + return (fgets(pwbuf, pwbuf_len, stdin) == NULL); saved_flags = tios.c_lflag; tios.c_lflag &= ~ECHO; tios.c_lflag |= ECHONL|ICANON; tcsetattr(STDIN_FILENO, TCSAFLUSH|TCSASOFT, &tios); - nopwd = (fgets(buf, buf_len, stdin) == NULL); + nopwd = (fgets(pwbuf, pwbuf_len, stdin) == NULL); tios.c_lflag = saved_flags; tcsetattr(STDIN_FILENO, TCSANOW|TCSASOFT, &tios); @@ -326,7 +326,7 @@ read_password(const char *prompt, char *buf, size_t buf_len) } #elif HAVE_GETPASSPHRASE || HAVE_GETPASS static int -read_password(const char *prompt, char *buf, size_t buf_len) +read_password(const char *prompt, char *pwbuf, size_t pwbuf_len) { char *pass; @@ -335,18 +335,18 @@ read_password(const char *prompt, char *buf, size_t buf_len) #else pass = getpass(prompt); #endif - if (pass == NULL || strlen(pass) >= buf_len) + if (pass == NULL || strlen(pass) >= pwbuf_len) return 1; - strcpy(buf, pass); + strcpy(pwbuf, pass); return 0; } #else static int -read_password(const char *prompt, char *buf, size_t buf_len) +read_password(const char *prompt, char *pwbuf, size_t pwbuf_len) { fprintf(stderr, prompt); - return (fgets(buf, buf_len, stdin) == NULL); + return (fgets(pwbuf, pwbuf_len, stdin) == NULL); } #endif @@ -944,6 +944,8 @@ main(int argc, char *argv[]) exit(EX_USAGE); } + fetchConnectionCacheInit(10, 1); + /* allocate buffer */ if (B_size < MINBUFSIZE) B_size = MINBUFSIZE; -- cgit v1.2.3