From 5dc52e3240da65ca0ddeb05e574d447b212a235e Mon Sep 17 00:00:00 2001 From: jkh Date: Fri, 14 Feb 1997 20:59:07 +0000 Subject: o Try to be more aggressive about reading in old configuration data so that we're more useful in multi-user mode. This is still not 100%, but it pulls in a lot more than it used to. Some of the "composite" variables in /etc/sysconfig are going to take more work. o Always write /etc/resolv.conf and /etc/hosts if it makes sense to do so. o Reset media properly when reselecting. Longstanding bogon. o Pull SIGPIPE handling out of package.c; I'm actually hoping to handle this differently shortly. o Fix bug where cancel in TCP setup dialog still checked data fields. I think this closes a PR, but I will have to go look. --- release/sysinstall/package.c | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) (limited to 'release/sysinstall/package.c') diff --git a/release/sysinstall/package.c b/release/sysinstall/package.c index 2ecb4b7..1104364 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$ + * $Id: package.c,v 1.55 1997/02/07 04:26:47 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -68,15 +68,6 @@ 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) @@ -116,7 +107,6 @@ 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(); @@ -138,9 +128,11 @@ package_extract(Device *dev, char *name, Boolean depended) tot = 0; (void)gettimeofday(&start, (struct timezone *)0); - while (!sigpipe_caught && (i = fread(buf, 1, BUFSIZ, fp)) > 0) { + while ((i = fread(buf, 1, BUFSIZ, fp)) > 0) { int seconds; + if (isDebug()) + msgDebug("Just read %d bytes from media device.\n", i); tot += i; /* Print statistics about how we're doing */ (void) gettimeofday(&stop, (struct timezone *)0); @@ -160,19 +152,19 @@ package_extract(Device *dev, char *name, Boolean depended) } close(pfd[1]); fclose(fp); - if (sigpipe_caught) - msgDebug("Caught SIGPIPE while trying to install the %s package.\n", name); + if (i == -1) + msgDebug("I/O error while reading in the %s package.\n", name); else msgInfo("Package %s read successfully - waiting for pkg_add", name); refresh(); i = waitpid(pid, &tot, 0); - if (sigpipe_caught || i < 0 || WEXITSTATUS(tot)) { + if (i < 0 || WEXITSTATUS(tot)) { if (variable_get(VAR_NO_CONFIRM)) - msgNotify("Add of package %s aborted due to some error -\n" - "Please check the debug screen for more info.", name); + 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 due to some error -\n" - "Please check the debug screen for more info.", name); + msgConfirm("Add of package %s aborted, error code %d -\n" + "Please check the debug screen for more info.", name, WEXITSTATUS(tot)); } else msgNotify("Package %s was added successfully", name); @@ -182,7 +174,6 @@ package_extract(Device *dev, char *name, Boolean depended) sleep(1); restorescr(w); - sigpipe_caught = FALSE; } } else { -- cgit v1.1