diff options
author | jkh <jkh@FreeBSD.org> | 1997-02-14 21:59:26 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1997-02-14 21:59:26 +0000 |
commit | 7c7a8730298c85240fdfe258c56b89b7b126dd29 (patch) | |
tree | 379e7b5918b14b01594cee319a7f7e1c2586a262 /release | |
parent | 17a99dd753fab2fb90f7524f9490d667265a61a6 (diff) | |
download | FreeBSD-src-7c7a8730298c85240fdfe258c56b89b7b126dd29.zip FreeBSD-src-7c7a8730298c85240fdfe258c56b89b7b126dd29.tar.gz |
Revert some of the previous change - on second thought...
Diffstat (limited to 'release')
-rw-r--r-- | release/sysinstall/package.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/release/sysinstall/package.c b/release/sysinstall/package.c index 1104364..8c0b1da 100644 --- a/release/sysinstall/package.c +++ b/release/sysinstall/package.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: package.c,v 1.55 1997/02/07 04:26:47 jkh Exp $ + * $Id: package.c,v 1.56 1997/02/14 20:59:06 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -68,6 +68,15 @@ package_exists(char *name) return !status; } +/* SIGPIPE handler */ +static Boolean sigpipe_caught = FALSE; + +static void +catch_pipe(int sig) +{ + sigpipe_caught = TRUE; +} + /* Extract a package based on a namespec and a media device */ int package_extract(Device *dev, char *name, Boolean depended) @@ -107,6 +116,7 @@ package_extract(Device *dev, char *name, Boolean depended) int i, tot, pfd[2]; pid_t pid; + signal(SIGPIPE, catch_pipe); msgNotify("Adding %s%s\nfrom %s", path, depended ? " (as a dependency)" : "", dev->name); pipe(pfd); pid = fork(); @@ -128,7 +138,7 @@ package_extract(Device *dev, char *name, Boolean depended) tot = 0; (void)gettimeofday(&start, (struct timezone *)0); - while ((i = fread(buf, 1, BUFSIZ, fp)) > 0) { + while (!sigpipe_caught && (i = fread(buf, 1, BUFSIZ, fp)) > 0) { int seconds; if (isDebug()) @@ -152,19 +162,20 @@ package_extract(Device *dev, char *name, Boolean depended) } close(pfd[1]); fclose(fp); - if (i == -1) - msgDebug("I/O error while reading in the %s package.\n", name); + if (sigpipe_caught || i == -1) + msgDebug("%s while trying to install the %s package.\n", + sigpipe_caught ? "SIGPIPE" : "I/O error", name); else msgInfo("Package %s read successfully - waiting for pkg_add", name); refresh(); i = waitpid(pid, &tot, 0); - if (i < 0 || WEXITSTATUS(tot)) { + if (sigpipe_caught || i < 0 || WEXITSTATUS(tot)) { if (variable_get(VAR_NO_CONFIRM)) msgNotify("Add of package %s aborted, error code %d -\n" "Please check the debug screen for more info.", name, WEXITSTATUS(tot)); else msgConfirm("Add of package %s aborted, error code %d -\n" - "Please check the debug screen for more info.", name, WEXITSTATUS(tot)); + "Please check the debug screen for more info.", name, WEXITSTATUS(tot)); } else msgNotify("Package %s was added successfully", name); @@ -174,6 +185,7 @@ package_extract(Device *dev, char *name, Boolean depended) sleep(1); restorescr(w); + sigpipe_caught = FALSE; } } else { |