Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-6]: src/usr.bin/progress Pull up revision 1.7 (requested by ross):
details: https://anonhg.NetBSD.org/src/rev/958aa9fe9d0a
branches: netbsd-1-6
changeset: 530235:958aa9fe9d0a
user: tron <tron%NetBSD.org@localhost>
date: Mon Jun 02 14:33:57 2003 +0000
description:
Pull up revision 1.7 (requested by ross):
Sigh, use an even more elaborate wait loop; it turns out we have a child
before we even start when run from sysinst. Thanks also Takao Shinohara.
diffstat:
usr.bin/progress/progress.c | 24 ++++++++++++++++++------
1 files changed, 18 insertions(+), 6 deletions(-)
diffs (59 lines):
diff -r bd92ec96f6b6 -r 958aa9fe9d0a usr.bin/progress/progress.c
--- a/usr.bin/progress/progress.c Mon Jun 02 14:30:34 2003 +0000
+++ b/usr.bin/progress/progress.c Mon Jun 02 14:33:57 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: progress.c,v 1.5.2.2 2003/02/10 09:39:12 jmc Exp $ */
+/* $NetBSD: progress.c,v 1.5.2.3 2003/06/02 14:33:57 tron Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: progress.c,v 1.5.2.2 2003/02/10 09:39:12 jmc Exp $");
+__RCSID("$NetBSD: progress.c,v 1.5.2.3 2003/06/02 14:33:57 tron Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -84,7 +84,7 @@
{
static char fb_buf[BUFSIZ];
char *infile = NULL;
- pid_t pid;
+ pid_t pid = 0, gzippid = 0;
int ch, fd, outpipe[2], waitstat;
int lflag = 0, zflag = 0;
ssize_t nr, nw, off;
@@ -152,7 +152,6 @@
}
/* Pipe input through gzip -dc if -z is given */
if (zflag) {
- pid_t gzippid;
int gzippipe[2];
if (pipe(gzippipe) < 0)
@@ -211,8 +210,21 @@
(unsigned) nr);
close(outpipe[1]);
- while(wait(&waitstat) != -1)
- continue;
+ while (pid || gzippid) {
+ int deadpid;
+
+ deadpid = wait(&waitstat);
+
+ if (deadpid == pid)
+ pid = 0;
+ else if (deadpid == gzippid)
+ gzippid = 0;
+ else if (deadpid != -1)
+ continue;
+ else if (errno == EINTR)
+ continue;
+ else break;
+ }
progressmeter(1);
return 0;
Home |
Main Index |
Thread Index |
Old Index