Adding error checking on fwrite/fflush in deps_log
Adding checks for record overflow in deps_log
Fix restat dirty check logic for edges with multiple outputs

In a normal dependency scan (see DependencyScan::RecomputeDirty) we mark
all outputs of an Edge as dirty if any of the outputs is dirty.  This is
the correct behavior because if any output is dirty, we will run the
command for that Edge and that can touch any of the outputs of the Edge
and so all the outputs should be marked dirty.

When updating the dirty state of Node's for a restat check, we were not
applying this logic, instead only those outputs that were actually
"dirty" were marked dirty.

Before this patch, restat edges with multiple outputs caused not all
dependent edges to run.
Add test for correct restat logic

When a single output of an edge is dirty, the restat check should
leave all outputs of that edge dirty.
Merge pull request #625 from nico/land

Merge pull request #617.
Merge pull request #612 from maximuska/proposed/deps_log_write_errors_checking

Proposed/deps log write errors checking