Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Sep 2019 21:53:26 +0000 (UTC)
From:      Matt Macy <mmacy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r352921 - head/bin/dd
Message-ID:  <201909302153.x8ULrQoO031850@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mmacy
Date: Mon Sep 30 21:53:26 2019
New Revision: 352921
URL: https://svnweb.freebsd.org/changeset/base/352921

Log:
  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

Modified:
  head/bin/dd/dd.c

Modified: head/bin/dd/dd.c
==============================================================================
--- head/bin/dd/dd.c	Mon Sep 30 21:48:12 2019	(r352920)
+++ head/bin/dd/dd.c	Mon Sep 30 21:53:26 2019	(r352921)
@@ -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);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909302153.x8ULrQoO031850>