summaryrefslogtreecommitdiff
path: root/usr.bin/progress
diff options
context:
space:
mode:
authorlukem <lukem@NetBSD.org>2021-01-07 12:02:52 +0000
committerlukem <lukem@NetBSD.org>2021-01-07 12:02:52 +0000
commiteb6fb56b2a0d357059fc4e49fdb3f328d25d276b (patch)
treea916aa3531908927e5acd321d879b5f9c1b3ecdd /usr.bin/progress
parent47592b89d60d0cc8d7f21e1b878ac440e72b0d20 (diff)
progress: handle EINTR in writes. PR/55914
Diffstat (limited to 'usr.bin/progress')
-rw-r--r--usr.bin/progress/progress.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/progress/progress.c b/usr.bin/progress/progress.c
index 2498bee93f2..0c6953820f2 100644
--- a/usr.bin/progress/progress.c
+++ b/usr.bin/progress/progress.c
@@ -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 @@ main(int argc, char *argv[])
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);