summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMatt Macy <mmacy@FreeBSD.org>2019-09-30 21:53:26 +0000
committerMatt Macy <mmacy@FreeBSD.org>2019-09-30 21:53:26 +0000
commit2048fe709808fc2658de070dd3ad98659508b041 (patch)
tree18d37ded15f1e743649b0e66256c1ea45b1060e9 /bin
parent3b96efbda0395b5bacfb6930dfaf664f5c718512 (diff)
downloadsrc-test2-2048fe709808fc2658de070dd3ad98659508b041.tar.gz
src-test2-2048fe709808fc2658de070dd3ad98659508b041.zip
dd: Check result of close(2) for errors
close(2) can return errors from previous operations which should not be ignored. PR: 229616 Submitted by: Thomas Hurst Reported by: Thomas Hurst Reviewed by: mmacy@ Obtained from: Ryan Moeller MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D21376
Notes
Notes: svn path=/head/; revision=352921
Diffstat (limited to 'bin')
-rw-r--r--bin/dd/dd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bin/dd/dd.c b/bin/dd/dd.c
index e3916fe7dcc0..64484bd7d564 100644
--- a/bin/dd/dd.c
+++ b/bin/dd/dd.c
@@ -124,7 +124,8 @@ main(int argc __unused, char *argv[])
* descriptor explicitly so that the summary handler (called
* from an atexit() hook) includes this work.
*/
- close(out.fd);
+ if (close(out.fd) == -1 && errno != EINTR)
+ err(1, "close");
exit(0);
}