CVS commit: src/usr.bin/progress
Module Name:src Committed By: gson Date: Tue Aug 17 07:18:43 UTC 2021 Modified Files: src/usr.bin/progress: progress.c Log Message: 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.24 -r1.25 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.24 src/usr.bin/progress/progress.c:1.25 --- src/usr.bin/progress/progress.c:1.24 Mon Aug 9 10:46:39 2021 +++ src/usr.bin/progress/progress.c Tue Aug 17 07:18:43 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: progress.c,v 1.24 2021/08/09 10:46:39 gson Exp $ */ +/* $NetBSD: progress.c,v 1.25 2021/08/17 07:18:43 gson Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: progress.c,v 1.24 2021/08/09 10:46:39 gson Exp $"); +__RCSID("$NetBSD: progress.c,v 1.25 2021/08/17 07:18:43 gson Exp $"); #endif/* not lint */ #include @@ -231,7 +231,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,
CVS commit: src/usr.bin/progress
Module Name:src Committed By: gson Date: Mon Aug 9 10:46:39 UTC 2021 Modified Files: src/usr.bin/progress: progress.c Log Message: Test errno when the return value from wait() indicates an error, not when it indicates success. PR install/56303. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 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.23 src/usr.bin/progress/progress.c:1.24 --- src/usr.bin/progress/progress.c:1.23 Thu Jan 7 12:02:52 2021 +++ src/usr.bin/progress/progress.c Mon Aug 9 10:46:39 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: progress.c,v 1.23 2021/01/07 12:02:52 lukem Exp $ */ +/* $NetBSD: progress.c,v 1.24 2021/08/09 10:46:39 gson Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: progress.c,v 1.23 2021/01/07 12:02:52 lukem Exp $"); +__RCSID("$NetBSD: progress.c,v 1.24 2021/08/09 10:46:39 gson Exp $"); #endif/* not lint */ #include @@ -259,7 +259,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;
CVS commit: src/usr.bin/progress
Module Name:src Committed By: lukem Date: Thu Jan 7 12:02:52 UTC 2021 Modified Files: src/usr.bin/progress: progress.c Log Message: progress: handle EINTR in writes. PR/55914 To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 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.22 src/usr.bin/progress/progress.c:1.23 --- src/usr.bin/progress/progress.c:1.22 Sat Apr 25 11:12:39 2020 +++ src/usr.bin/progress/progress.c Thu Jan 7 12:02:52 2021 @@ -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 #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 @@ -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);
CVS commit: src/usr.bin/progress
Module Name:src Committed By: simonb Date: Sat Apr 25 11:12:39 UTC 2020 Modified Files: src/usr.bin/progress: progress.c Log Message: Whitespace nit. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 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 src/usr.bin/progress/progress.c:1.22 --- src/usr.bin/progress/progress.c:1.21 Sat Jan 17 10:57:51 2015 +++ src/usr.bin/progress/progress.c Sat Apr 25 11:12:39 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: progress.c,v 1.21 2015/01/17 10:57:51 gson Exp $ */ +/* $NetBSD: progress.c,v 1.22 2020/04/25 11:12:39 simonb Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: progress.c,v 1.21 2015/01/17 10:57:51 gson Exp $"); +__RCSID("$NetBSD: progress.c,v 1.22 2020/04/25 11:12:39 simonb Exp $"); #endif/* not lint */ #include @@ -75,7 +75,6 @@ usage(void) exit(EXIT_FAILURE); } - int main(int argc, char *argv[]) {
CVS commit: src/usr.bin/progress
Module Name:src Committed By: gson Date: Sat Jan 17 10:57:51 UTC 2015 Modified Files: src/usr.bin/progress: progress.c Log Message: Retry read() on EINTR. Fixes premature exit of /dev/null To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 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.20 src/usr.bin/progress/progress.c:1.21 --- src/usr.bin/progress/progress.c:1.20 Wed Jun 27 22:07:36 2012 +++ src/usr.bin/progress/progress.c Sat Jan 17 10:57:51 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: progress.c,v 1.20 2012/06/27 22:07:36 riastradh Exp $ */ +/* $NetBSD: progress.c,v 1.21 2015/01/17 10:57:51 gson Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: progress.c,v 1.20 2012/06/27 22:07:36 riastradh Exp $"); +__RCSID("$NetBSD: progress.c,v 1.21 2015/01/17 10:57:51 gson Exp $"); #endif/* not lint */ #include @@ -228,7 +228,12 @@ main(int argc, char *argv[]) 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 @@ main(int argc, char *argv[]) err(1, "writing %u bytes to output pipe", (unsigned) nr); } + } close(outpipe[1]); gzipstat = 0;
CVS commit: src/usr.bin/progress
Module Name:src Committed By: tron Date: Sat Jul 17 10:51:04 UTC 2010 Modified Files: src/usr.bin/progress: progress.c Log Message: Fix argument handling of the "-b" option on 64bit platforms. Using "-b 1024k" would previously fail with this error message: progress: buffer size 1048576 is greater than -1. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 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.17 src/usr.bin/progress/progress.c:1.18 --- src/usr.bin/progress/progress.c:1.17 Mon May 26 04:53:11 2008 +++ src/usr.bin/progress/progress.c Sat Jul 17 10:51:03 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: progress.c,v 1.17 2008/05/26 04:53:11 dholland Exp $ */ +/* $NetBSD: progress.c,v 1.18 2010/07/17 10:51:03 tron Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: progress.c,v 1.17 2008/05/26 04:53:11 dholland Exp $"); +__RCSID("$NetBSD: progress.c,v 1.18 2010/07/17 10:51:03 tron Exp $"); #endif/* not lint */ #include @@ -112,7 +112,7 @@ switch (ch) { case 'b': buffersize = (size_t) strsuftoll("buffer size", optarg, - 0, SIZE_T_MAX); + 0, SSIZE_MAX); break; case 'e': eflag++;