summaryrefslogtreecommitdiff
path: root/ssh-keyscan.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2000-12-27 04:57:41 +0000
committerBen Lindstrom <mouring@eviladmin.org>2000-12-27 04:57:41 +0000
commit2c467a20f4f82000908b7c3d158e8a7960d3bad1 (patch)
tree7a41adf856303d56e5ed5788c1f1c7d394302235 /ssh-keyscan.c
parent3deda8b091e571f5577ae50b75b89a21caed6aee (diff)
20001227
- (bal) Typo in configure.in: entut?ent should be endut?ent. Suggested by Takumi Yamane <yamtak@b-session.com> - (bal) Checks for getrlimit(), sysconf(), and setdtablesize(). Patch by Corinna Vinschen <vinschen@redhat.com>
Diffstat (limited to 'ssh-keyscan.c')
-rw-r--r--ssh-keyscan.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/ssh-keyscan.c b/ssh-keyscan.c
index d85cc337..41bd733c 100644
--- a/ssh-keyscan.c
+++ b/ssh-keyscan.c
@@ -183,6 +183,7 @@ getline(Linebuf * lb)
static int
fdlim_get(int hard)
{
+#if defined(HAVE_GETRLIMIT)
struct rlimit rlfd;
if (getrlimit(RLIMIT_NOFILE, &rlfd) < 0)
return (-1);
@@ -190,19 +191,30 @@ fdlim_get(int hard)
return 10000;
else
return hard ? rlfd.rlim_max : rlfd.rlim_cur;
+#elif defined (HAVE_SYSCONF)
+ return sysconf (_SC_OPEN_MAX);
+#else
+ return 10000;
+#endif
}
static int
fdlim_set(int lim)
{
+#if defined(HAVE_SETRLIMIT)
struct rlimit rlfd;
+#endif
if (lim <= 0)
return (-1);
+#if defined(HAVE_SETRLIMIT)
if (getrlimit(RLIMIT_NOFILE, &rlfd) < 0)
return (-1);
rlfd.rlim_cur = lim;
if (setrlimit(RLIMIT_NOFILE, &rlfd) < 0)
return (-1);
+#elif defined (HAVE_SETDTABLESIZE)
+ setdtablesize (lim);
+#endif
return (0);
}