summaryrefslogtreecommitdiffstats
path: root/bin/dd
diff options
context:
space:
mode:
authorbrooks <brooks@FreeBSD.org>2013-04-03 19:19:45 +0000
committerbrooks <brooks@FreeBSD.org>2013-04-03 19:19:45 +0000
commite241794c89cea9f7550619f5f3e167a6447455ab (patch)
tree815bd81744d381e653441bf0dcf168f91fd1e9f3 /bin/dd
parent02643447e4fbc7138d945ad34f2c7e9e7c948121 (diff)
downloadFreeBSD-src-e241794c89cea9f7550619f5f3e167a6447455ab.zip
FreeBSD-src-e241794c89cea9f7550619f5f3e167a6447455ab.tar.gz
IFP4 change 222074.
Introduce an explicit close of the output descriptor so that work done on close is accounted for in the summary output triggered at exit (implicit close()s occur after atexit() hooks). This is useful because some devices such as cfi(4) may perform signficant work after a close occurs (e.g. erasing and rewriting a block of flash).
Diffstat (limited to 'bin/dd')
-rw-r--r--bin/dd/dd.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/bin/dd/dd.c b/bin/dd/dd.c
index 637e0cc..01b66fc 100644
--- a/bin/dd/dd.c
+++ b/bin/dd/dd.c
@@ -98,6 +98,13 @@ main(int argc __unused, char *argv[])
dd_in();
dd_close();
+ /*
+ * Some devices such as cfi(4) may perform significant amounts
+ * of work when a write descriptor is closed. Close the out
+ * descriptor explicitly so that the summary handler (called
+ * from an atexit() hook) includes this work.
+ */
+ close(out.fd);
exit(0);
}
OpenPOWER on IntegriCloud