summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sysinstall/package.c
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1997-03-11 09:29:42 +0000
committerjkh <jkh@FreeBSD.org>1997-03-11 09:29:42 +0000
commit266d7fba02761d8720cb17d2c28b06e8c5df5204 (patch)
treef044d80f7113a0bb3f6fd902493be0d4e00053ce /usr.sbin/sysinstall/package.c
parentaf5e57db7f46089295d1a3d8956538a98ad8497e (diff)
downloadFreeBSD-src-266d7fba02761d8720cb17d2c28b06e8c5df5204.zip
FreeBSD-src-266d7fba02761d8720cb17d2c28b06e8c5df5204.tar.gz
Merge all my sysinstall changes over to the 2.1 branch.
I just have this feeling... :)
Diffstat (limited to 'usr.sbin/sysinstall/package.c')
-rw-r--r--usr.sbin/sysinstall/package.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/usr.sbin/sysinstall/package.c b/usr.sbin/sysinstall/package.c
index d6759ff..4a6afee 100644
--- a/usr.sbin/sysinstall/package.c
+++ b/usr.sbin/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.58 1997/02/14 23:00:01 jkh Exp $
+ * $Id: package.c,v 1.59 1997/03/08 12:57:48 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,14 +107,13 @@ 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();
if (!pid) {
dup2(pfd[0], 0); close(pfd[0]);
dup2(DebugFD, 1);
- dup2(DebugFD, 2);
+ close(2);
close(pfd[1]);
i = execl("/usr/sbin/pkg_add", "/usr/sbin/pkg_add", "-", 0);
if (isDebug())
@@ -138,7 +128,7 @@ 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;
tot += i;
@@ -160,20 +150,19 @@ package_extract(Device *dev, char *name, Boolean depended)
}
close(pfd[1]);
fclose(fp);
- if (sigpipe_caught || i == -1)
- msgDebug("%s while trying to install the %s package.\n",
- sigpipe_caught ? "SIGPIPE" : "I/O error", 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, 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);
@@ -183,7 +172,6 @@ package_extract(Device *dev, char *name, Boolean depended)
sleep(1);
restorescr(w);
- sigpipe_caught = FALSE;
}
}
else {
OpenPOWER on IntegriCloud