Module Name: src Committed By: martin Date: Tue Oct 25 17:52:46 UTC 2022
Modified Files: src/usr.bin/progress [netbsd-9]: progress.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.21.18.1 -r1.21.18.2 src/usr.bin/progress/progress.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/progress/progress.c diff -u src/usr.bin/progress/progress.c:1.21.18.1 src/usr.bin/progress/progress.c:1.21.18.2 --- src/usr.bin/progress/progress.c:1.21.18.1 Fri Jan 29 18:27:05 2021 +++ src/usr.bin/progress/progress.c Tue Oct 25 17:52:46 2022 @@ -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 @@ main(int argc, char *argv[]) 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 @@ main(int argc, char *argv[]) */ ws = WIFSIGNALED(ws) ? WTERMSIG(ws) : WEXITSTATUS(ws); - if (deadpid != -1 && errno == EINTR) + if (deadpid == -1 && errno == EINTR) continue; if (deadpid == pid) { pid = 0;