diff options
author | Ben Lindstrom <mouring@eviladmin.org> | 2000-12-27 04:57:41 +0000 |
---|---|---|
committer | Ben Lindstrom <mouring@eviladmin.org> | 2000-12-27 04:57:41 +0000 |
commit | 2c467a20f4f82000908b7c3d158e8a7960d3bad1 (patch) | |
tree | 7a41adf856303d56e5ed5788c1f1c7d394302235 /ssh-keyscan.c | |
parent | 3deda8b091e571f5577ae50b75b89a21caed6aee (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.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/ssh-keyscan.c b/ssh-keyscan.c index d85cc337f..41bd733ce 100644 --- a/ssh-keyscan.c +++ b/ssh-keyscan.c | |||
@@ -183,6 +183,7 @@ getline(Linebuf * lb) | |||
183 | static int | 183 | static int |
184 | fdlim_get(int hard) | 184 | fdlim_get(int hard) |
185 | { | 185 | { |
186 | #if defined(HAVE_GETRLIMIT) | ||
186 | struct rlimit rlfd; | 187 | struct rlimit rlfd; |
187 | if (getrlimit(RLIMIT_NOFILE, &rlfd) < 0) | 188 | if (getrlimit(RLIMIT_NOFILE, &rlfd) < 0) |
188 | return (-1); | 189 | return (-1); |
@@ -190,19 +191,30 @@ fdlim_get(int hard) | |||
190 | return 10000; | 191 | return 10000; |
191 | else | 192 | else |
192 | return hard ? rlfd.rlim_max : rlfd.rlim_cur; | 193 | return hard ? rlfd.rlim_max : rlfd.rlim_cur; |
194 | #elif defined (HAVE_SYSCONF) | ||
195 | return sysconf (_SC_OPEN_MAX); | ||
196 | #else | ||
197 | return 10000; | ||
198 | #endif | ||
193 | } | 199 | } |
194 | 200 | ||
195 | static int | 201 | static int |
196 | fdlim_set(int lim) | 202 | fdlim_set(int lim) |
197 | { | 203 | { |
204 | #if defined(HAVE_SETRLIMIT) | ||
198 | struct rlimit rlfd; | 205 | struct rlimit rlfd; |
206 | #endif | ||
199 | if (lim <= 0) | 207 | if (lim <= 0) |
200 | return (-1); | 208 | return (-1); |
209 | #if defined(HAVE_SETRLIMIT) | ||
201 | if (getrlimit(RLIMIT_NOFILE, &rlfd) < 0) | 210 | if (getrlimit(RLIMIT_NOFILE, &rlfd) < 0) |
202 | return (-1); | 211 | return (-1); |
203 | rlfd.rlim_cur = lim; | 212 | rlfd.rlim_cur = lim; |
204 | if (setrlimit(RLIMIT_NOFILE, &rlfd) < 0) | 213 | if (setrlimit(RLIMIT_NOFILE, &rlfd) < 0) |
205 | return (-1); | 214 | return (-1); |
215 | #elif defined (HAVE_SETDTABLESIZE) | ||
216 | setdtablesize (lim); | ||
217 | #endif | ||
206 | return (0); | 218 | return (0); |
207 | } | 219 | } |
208 | 220 | ||