antirez/redis — pull request #1227 by ripcurld00d (2013-07-30 17:28:30+00:00)
Title: Fix issue #356 - server.maxclients could be minus!

## Introduction
This is my attempt to fix issue #356.
What I have done is modifying `server.maxclients`, in case `ulimit -n` is set to a smaller number than 32.

## Tests
Unfortunately, running `[exec ulimit -n $fd_num]` gives error in TCL. Therefore, I could not write a decent unit-tests for this scenario. Nevertheless, I did replicate it as described in the issue.

## Notes
* Do we really need the [`while` loop](https://github.com/antirez/redis/blob/unstable/src/redis.c#L1385) ?
Is it because of [this line](https://github.com/antirez/redis/blob/unstable/src/redis.c#L1388)

if (setrlimit(RLIMIT_NOFILE,&limit) != -1) break;

* Feel free to share your thoughts.
* I would like to get a good reference regard how to change number of `fd`s through TCL script. I did search on Google, though.