antirez/redis — pull request #1606 by mattsta (2014-03-13 18:54:13+00:00)
Title: Fix data loss when save AOF/RDB with no free space

As reported in https://github.com/antirez/redis/issues/1604,
Redis was exiting and emptying out datasets. This commit
will greatly reduce such occurrences.

If you are running an old (non-3.0+) Redis, this patch should
apply cleanly to anything newer than Redis 2.1.2.

Previously, the (!fp) would only catch lack of free space
under OS X. Linux waits to discover it can't write until
it actually writes contents to disk.

(fwrite() returns success even if the underlying file
has no free space to write into. All the errors
only show up at flush/sync/close time.)

Fixes antirez/redis#1604