summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sade/system.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/sade/system.c')
-rw-r--r--usr.sbin/sade/system.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/usr.sbin/sade/system.c b/usr.sbin/sade/system.c
index 3424070..1161ce6 100644
--- a/usr.sbin/sade/system.c
+++ b/usr.sbin/sade/system.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: system.c,v 1.68 1996/12/11 19:35:26 jkh Exp $
+ * $Id: system.c,v 1.69 1996/12/12 08:23:51 jkh Exp $
*
* Jordan Hubbard
*
@@ -29,6 +29,8 @@
#define DOC_TMP_DIR "/tmp"
#define DOC_TMP_FILE "/tmp/doc.tmp"
+static pid_t ehs_pid;
+
/*
* Handle interrupt signals - this probably won't work in all cases
* due to our having bogotified the internal state of dialog or curses,
@@ -294,7 +296,28 @@ void
systemCreateHoloshell(void)
{
if (OnVTY && RunningAsInit) {
- if (!fork()) {
+
+ if (ehs_pid != 0) {
+ int pstat;
+
+ if (kill(ehs_pid, 0) == 0) {
+
+ if (msgYesNo("There seems to be an emergency holographic shell\n"
+ "already running von VTY 4.\n"
+ "Kill it and start a new one?"))
+ return;
+
+ /* try cleaning up as much as possible */
+ (void) kill(ehs_pid, SIGHUP);
+ sleep(1);
+ (void) kill(ehs_pid, SIGKILL);
+ }
+
+ /* avoid too many zombies */
+ (void) waitpid(ehs_pid, &pstat, WNOHANG);
+ }
+
+ if ((ehs_pid = fork()) == 0) {
int i, fd;
struct termios foo;
extern int login_tty(int);
OpenPOWER on IntegriCloud