dumpstate: fix double close.
fdopen takes ownership of the fd it's given, but dump_stat_from_fd
doesn't own the fd it's passed. These APIs should probably be cleaned
up to pass a unique_fd to explicitly transfer ownership, since the
caller immediately closes the fd afterwards, but until then, just dup.
Test: mma
Change-Id: Ie3a3c1b1951d6cc712850c326ca0bcfe46155a83
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index d94c649..3af8121 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -561,7 +561,7 @@
bool z;
char *cp, *buffer = NULL;
size_t i = 0;
- FILE *fp = fdopen(fd, "rb");
+ FILE *fp = fdopen(dup(fd), "rb");
getline(&buffer, &i, fp);
fclose(fp);
if (!buffer) {