aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk@arm.linux.org.uk>2002-09-02 22:44:13 +0000
committerH. Peter Anvin <hpa@zytor.com>2002-09-02 22:44:13 +0000
commite768df62b90c9136b556a3b222c6874ddbce662a (patch)
tree1db57af05e36bfe5e1d65dafca322a177f3dc6a1
parentd721822e5a0f3d3ccfbd63f57db1cb2b50b017b9 (diff)
downloadklibc-e768df62b90c9136b556a3b222c6874ddbce662a.tar.gz
Make dd close both in and out fds when done, reporting any errors foundklibc-0.64
-rw-r--r--utils/dd.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/utils/dd.c b/utils/dd.c
index 0cf7947d092a8..dea6538fc0b43 100644
--- a/utils/dd.c
+++ b/utils/dd.c
@@ -509,6 +509,11 @@ int main(int argc, char *argv[])
*/
ret = dd(rd_fd, wr_fd, &stats);
+ if (close(rd_fd) == -1)
+ perror(OPT_IF->str ? OPT_IF->str : "stdin");
+ if (close(wr_fd) == -1)
+ perror(OPT_OF->str ? OPT_OF->str : "stdout");
+
fprintf(stderr, "%u+%u records in\n",
stats.in_full, stats.in_partial);
fprintf(stderr, "%u+%u records out\n",