Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/progress progress: handle EINTR in writes. PR/55914



details:   https://anonhg.NetBSD.org/src/rev/08b2ad7347f4
branches:  trunk
changeset: 949268:08b2ad7347f4
user:      lukem <lukem%NetBSD.org@localhost>
date:      Thu Jan 07 12:02:52 2021 +0000

description:
progress: handle EINTR in writes. PR/55914

diffstat:

 usr.bin/progress/progress.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r c9a0867fead2 -r 08b2ad7347f4 usr.bin/progress/progress.c
--- a/usr.bin/progress/progress.c       Thu Jan 07 07:40:39 2021 +0000
+++ b/usr.bin/progress/progress.c       Thu Jan 07 12:02:52 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: progress.c,v 1.22 2020/04/25 11:12:39 simonb Exp $ */
+/*     $NetBSD: progress.c,v 1.23 2021/01/07 12:02:52 lukem Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: progress.c,v 1.22 2020/04/25 11:12:39 simonb Exp $");
+__RCSID("$NetBSD: progress.c,v 1.23 2021/01/07 12:02:52 lukem Exp $");
 #endif                         /* not lint */
 
 #include <sys/types.h>
@@ -236,6 +236,10 @@
                for (off = 0; nr; nr -= nw, off += nw, bytes += nw)
                        if ((nw = write(outpipe[1], fb_buf + off,
                            (size_t) nr)) < 0) {
+                               if (errno == EINTR) {
+                                       nw = 0;
+                                       continue;
+                               }
                                progressmeter(1);
                                err(1, "writing %u bytes to output pipe",
                                                        (unsigned) nr);



Home | Main Index | Thread Index | Old Index