summaryrefslogtreecommitdiff
path: root/ssh-keyscan.c
diff options
context:
space:
mode:
authormouring <mouring>2000-12-27 04:57:41 +0000
committermouring <mouring>2000-12-27 04:57:41 +0000
commit53837d4a8183cb6c628bf69a5494a5b2efd294c7 (patch)
tree0f2bf5d1b8a69368c8e1b4e75652edf85b2251d3 /ssh-keyscan.c
parentc596bb7fb4ea279b58fed529d62b87e2137bb4dd (diff)
downloadopenssh-53837d4a8183cb6c628bf69a5494a5b2efd294c7.tar.gz
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);
}