static void close_our_files(int client_fd)
{
int i;
for (i = 0; i < 256; i++) {
if (i == client_fd) continue;
close(i);
}
改为:
static void close_our_files(int client_fd)
{
struct rlimit limits;
int i;
getrlimit(RLIMIT_NOFILE,&limits);
for (i = 0; i < limits.rlim_max; i++) {
if (i == client_fd) continue;
close(i);
}