Fail SYNC if background save child aborted due to a signal.
Merge pull request #1896 from yossigo/bgsave-signal-fix

Fail SYNC if background save child aborted due to a signal.
redis-cli: Re-attach selected DB after auth

Previously, if you did SELECT then AUTH, redis-cli
would show your SELECT'd db even though it didn't
happen.

Note: running into this situation is a (hopefully) very limited
used case of people using multiple DBs and AUTH all at the same
time.

Fixes antirez#1639
redis-cli: stop showing incorrectly selected DB

Previously redis-cli would happily show "-1" or "99999"
as valid DB choices.

Now, if the SELECT call returned an error, we don't update
the DB number in the CLI.

Inspired by @anupshendkar in #1313

Fixes #566, #1313
redis-cli: Add --no-raw option

Some people need formatted output even when they have no
interactive tty.

Fixes #760
Add support for compiling on AIX

Closes #1900
Clarify AIX "#undef hz".
Remove redundant else/return block

Fixes #1741
redis-cli: fix latency result output

(Cleaned up a little by @mattsta)

Closes #1774
cluster: fix node connection memory leak

Cluster leaks memory while connecting due to missing freeaddrinfo()

(Commit modified by @antirez. The freeaddrinfo() call was misplaced so
 in case of no address was bound, the memory leak was still there).

Closes #1801
scripting: no eval with negative key count

Negative key count causes segfault in Lua functions.

Fixes #1842
Closes #1843
Handle large getrange requests

Previously the end was casted to a smaller type
which resulted in a wrong check and failed
with values larger than handled by unsigned.

Closes #1847, #1844
Fix key extraction for SORT

We only want to use the last STORE key, but we have to record
we actually found a STORE key so we can increment the final return
key count.

Test added to prevent further regression.

Closes #1883, #1645, #1647
Fix intset midpoint selection

The classic (min+max)/2 is provably unsafe.  Fixed
as recommended in research:
http://googleresearch.blogspot.com/2006/06/extra-extra-read-all-about-it-nearly.html

Fix inspired by @wjin, but I used a different approach.
(later, I found @kuebler fixed the same issue too).

Fixes #1741, #1602
Add graceful exit when Ctrl-C is received
Force quit when receiving a second SIGINT.

Also quit ASAP when we are still loading a DB, since care is not needed
in this special condition, especially for a SIGINT.
Fix issues raised by clang analyzer

Modified by @antirez since the original fix to genInfoString() looked
weak. Probably the clang analyzer complained about `section` being
possibly NULL, and strcasecmp() called with a NULL pointer. In the
practice this can never happen, still for the sake of correctness
the right fix is not to modify only the first call, but to set `section`
to the value of "default" if it happens to be NULL.

Closes #1660
redis-check-dump: use names instead of magic nums

Use constants to avoid magic numbers in `types`, which is an array
that stores the names of `REDIS` types.

Closes #1681
Change unixsocketperm comment to 700 from 755

According to unix manuals, "Connecting to the socket object requires
read/write permission." -- mode 755 is useless for anybody
other than the owner.

Fixes #1696
install_server.sh: add missing bang

This was discovered by _bodya and reported in the IRC channel.
Everything worked fine as these scripts are always executed as shell
scripts.

Closes #1728