mirror of
https://github.com/fluencelabs/redis
synced 2025-03-17 16:10:50 +00:00
Avoid closing invalid FDs to make Valgrind happier.
This commit is contained in:
parent
413c2bc180
commit
f9fac7f777
@ -1555,7 +1555,11 @@ int restartServer(int flags, mstime_t delay) {
|
||||
|
||||
/* Close all file descriptors, with the exception of stdin, stdout, strerr
|
||||
* which are useful if we restart a Redis server which is not daemonized. */
|
||||
for (j = 3; j < (int)server.maxclients + 1024; j++) close(j);
|
||||
for (j = 3; j < (int)server.maxclients + 1024; j++) {
|
||||
/* Test the descriptor validity before closing it, otherwise
|
||||
* Valgrind issues a warning on close(). */
|
||||
if (fcntl(j,F_GETFD) != -1) close(j);
|
||||
}
|
||||
|
||||
/* Execute the server with the original command line. */
|
||||
if (delay) usleep(delay*1000);
|
||||
|
Loading…
x
Reference in New Issue
Block a user