Commit eff3d2e6 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(initialize): Don't allow the number of open files to be larger than

	FD_SETSIZE.
parent d4a7a8f9
/*
* $Id: ramkomd.c,v 0.107 2002/10/26 22:46:34 ceder Exp $
* $Id: ramkomd.c,v 0.108 2002/10/27 11:06:10 ceder Exp $
* Copyright (C) 1991-1999, 2001-2002 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -382,6 +382,14 @@ initialize(const char *config_file)
}
#endif
if (param.no_files != -1 && param.no_files > FD_SETSIZE)
{
fprintf(stderr,
"The \"Open files: %ld\" is too large: FD_SETSIZE is %ld\n",
(long)param.no_files, (long)FD_SETSIZE);
exit(1);
}
#ifdef USING_RLIMIT_NOFILE
if (getrlimit(RLIMIT_NOFILE, &rlim) < 0)
{
......@@ -443,6 +451,9 @@ initialize(const char *config_file)
# error Do not know how to find maximum number of open files.
#endif
if (fd_ceiling > FD_SETSIZE)
fd_ceiling = FD_SETSIZE;
go_daemon();
if (lock_db() < 0)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment