Fix a few bugs related to dumping files.

Fixes:

- Fix double print of header in dump_file.

- Fix a few possible file descriptor leaks.

- Add /d/ as another directory which should be skipped when printing out
  last mod time of a file.

- Fix possible crash if the path passed to _dump_file_from_fd is less than
  the length of one of the directory checks.

Change-Id: I450dfab76fd0ce4d4dca9ed39c82a980054f3cc3
diff --git a/cmds/dumpstate/dumpstate.h b/cmds/dumpstate/dumpstate.h
index f9f20d2..25ae453 100644
--- a/cmds/dumpstate/dumpstate.h
+++ b/cmds/dumpstate/dumpstate.h
@@ -23,9 +23,10 @@
 
 #ifdef _DUMPSTATE_DRY_RUN_
 #define ON_DRY_RUN_RETURN(X) return X
-#endif
-#ifndef _DUMPSTATE_DRY_RUN_
+#define ON_DRY_RUN(code) code
+#else
 #define ON_DRY_RUN_RETURN(X)
+#define ON_DRY_RUN(code)
 #endif