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);
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to