Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/b9aa487f00d3
branches:  netbsd-9
changeset: 372003:b9aa487f00d3
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Oct 25 17:52:46 2022 +0000

description:
Pull up following revision(s) (requested by riastradh in ticket #1547):

        usr.bin/progress/progress.c: revision 1.24
        usr.bin/progress/progress.c: revision 1.25

Test errno when the return value from wait() indicates an error, not
when it indicates success.  PR install/56303.

Add missing check for error returns from read().  Found by inspection
while reviewing the changes suggested by RVP in PR install/56303, but
not believed to be the cause of the failure reported in that PR.

diffstat:

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

diffs (40 lines):

diff -r a5ccb256f879 -r b9aa487f00d3 usr.bin/progress/progress.c
--- a/usr.bin/progress/progress.c       Thu Oct 20 13:20:35 2022 +0000
+++ b/usr.bin/progress/progress.c       Tue Oct 25 17:52:46 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: progress.c,v 1.21.18.1 2021/01/29 18:27:05 martin Exp $ */
+/*     $NetBSD: progress.c,v 1.21.18.2 2022/10/25 17:52:46 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.21.18.1 2021/01/29 18:27:05 martin Exp $");
+__RCSID("$NetBSD: progress.c,v 1.21.18.2 2022/10/25 17:52:46 martin Exp $");
 #endif                         /* not lint */
 
 #include <sys/types.h>
@@ -232,7 +232,11 @@
                do {
                        nr = read(fd, fb_buf, buffersize);
                } while (nr < 0 && errno == EINTR);
-               if (nr <= 0)
+               if (nr < 0) {
+                       progressmeter(1);
+                       err(1, "reading input");
+               }
+               if (nr == 0)
                        break;
                for (off = 0; nr; nr -= nw, off += nw, bytes += nw)
                        if ((nw = write(outpipe[1], fb_buf + off,
@@ -260,7 +264,7 @@
                 */
                ws = WIFSIGNALED(ws) ? WTERMSIG(ws) : WEXITSTATUS(ws);
 
-               if (deadpid != -1 && errno == EINTR)
+               if (deadpid == -1 && errno == EINTR)
                        continue;
                if (deadpid == pid) {
                        pid = 0;



Home | Main Index | Thread Index | Old Index