From e00074a7267a2a73a75003dadf43459b7191349b Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Mon, 24 Nov 2003 13:07:45 +1100 Subject: [PATCH] - (djm) OpenBSD CVS Sync - djm@cvs.openbsd.org 2003/11/23 23:17:34 [ssh-keyscan.c] from portable - use sysconf to detect fd limit; ok markus@ (tidy diff by adding SSH_SSFDMAX macro to defines.h) --- ChangeLog | 7 ++++++- defines.h | 10 +++++++++- ssh-keyscan.c | 6 ++---- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4aa9e1d38..c04479d7b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,11 @@ 20031123 - (djm) [canohost.c] Move IPv4inV6 mapped address normalisation to its own function and call it unconditionally + - (djm) OpenBSD CVS Sync + - djm@cvs.openbsd.org 2003/11/23 23:17:34 + [ssh-keyscan.c] + from portable - use sysconf to detect fd limit; ok markus@ + (tidy diff by adding SSH_SSFDMAX macro to defines.h) 20031122 - (dtucker) [channels.c] Make AIX write limit code clearer. Suggested by djm@ @@ -1514,4 +1519,4 @@ - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo. Report from murple@murple.net, diagnosis from dtucker@zip.com.au -$Id: ChangeLog,v 1.3126 2003/11/24 01:57:25 djm Exp $ +$Id: ChangeLog,v 1.3127 2003/11/24 02:07:45 djm Exp $ diff --git a/defines.h b/defines.h index adf45d7fa..6d197c769 100644 --- a/defines.h +++ b/defines.h @@ -25,7 +25,7 @@ #ifndef _DEFINES_H #define _DEFINES_H -/* $Id: defines.h,v 1.104 2003/11/21 12:48:55 djm Exp $ */ +/* $Id: defines.h,v 1.105 2003/11/24 02:07:46 djm Exp $ */ /* Constants */ @@ -529,6 +529,14 @@ struct winsize { # define krb5_get_err_text(context,code) error_message(code) #endif +/* Maximum number of file descriptors available */ +#ifdef HAVE_SYSCONF +# define SSH_SYSFDMAX sysconf(_SC_OPEN_MAX) +#else +# define SSH_SYSFDMAX 10000 +#endif + + /* * Define this to use pipes instead of socketpairs for communicating with the * client program. Socketpairs do not seem to work on all systems. diff --git a/ssh-keyscan.c b/ssh-keyscan.c index 9506ec196..04d43da35 100644 --- a/ssh-keyscan.c +++ b/ssh-keyscan.c @@ -214,13 +214,11 @@ fdlim_get(int hard) if (getrlimit(RLIMIT_NOFILE, &rlfd) < 0) return (-1); if ((hard ? rlfd.rlim_max : rlfd.rlim_cur) == RLIM_INFINITY) - return 10000; + return SSH_SYSFDMAX; else return hard ? rlfd.rlim_max : rlfd.rlim_cur; -#elif defined (HAVE_SYSCONF) - return sysconf (_SC_OPEN_MAX); #else - return 10000; + return SSH_SYSFDMAX; #endif }