Source-Changes-HG archive

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

[src/netbsd-7]: src/usr.bin/progress Pull up following revision(s) (requested...



details:   https://anonhg.NetBSD.org/src/rev/e72c4273bd92
branches:  netbsd-7
changeset: 799009:e72c4273bd92
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Feb 21 13:47:00 2015 +0000

description:
Pull up following revision(s) (requested by gson in ticket #532):
        usr.bin/progress/progress.c: revision 1.21
Retry read() on EINTR.  Fixes premature exit of
</dev/random progress -e cat >/dev/null

diffstat:

 usr.bin/progress/progress.c |  12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diffs (40 lines):

diff -r eea0e7a57b19 -r e72c4273bd92 usr.bin/progress/progress.c
--- a/usr.bin/progress/progress.c       Sat Feb 21 13:40:19 2015 +0000
+++ b/usr.bin/progress/progress.c       Sat Feb 21 13:47:00 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: progress.c,v 1.20 2012/06/27 22:07:36 riastradh Exp $ */
+/*     $NetBSD: progress.c,v 1.20.10.1 2015/02/21 13:47:00 martin Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: progress.c,v 1.20 2012/06/27 22:07:36 riastradh Exp $");
+__RCSID("$NetBSD: progress.c,v 1.20.10.1 2015/02/21 13:47:00 martin Exp $");
 #endif                         /* not lint */
 
 #include <sys/types.h>
@@ -228,7 +228,12 @@
        signal(SIGPIPE, broken_pipe);
        progressmeter(-1);
 
-       while ((nr = read(fd, fb_buf, buffersize)) > 0)
+       while (1) {
+               do {
+                       nr = read(fd, fb_buf, buffersize);
+               } while (nr < 0 && errno == EINTR);
+               if (nr <= 0)
+                       break;
                for (off = 0; nr; nr -= nw, off += nw, bytes += nw)
                        if ((nw = write(outpipe[1], fb_buf + off,
                            (size_t) nr)) < 0) {
@@ -236,6 +241,7 @@
                                err(1, "writing %u bytes to output pipe",
                                                        (unsigned) nr);
                        }
+       }
        close(outpipe[1]);
 
        gzipstat = 0;



Home | Main Index | Thread Index | Old Index