revised PATCH

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Neal Becker
Fecha:  
A: exim-users
Asunto: revised PATCH
This is probably a little better:

--- src/daemon.c    1996/04/19 13:36:04    1.1
+++ src/daemon.c    1996/04/19 13:44:37
@@ -8,7 +8,7 @@



 #include "exim.h"
-
+#include <sys/ioctl.h>        /* for TIOCNOTTY */



/*************************************************
@@ -368,11 +368,26 @@

 if (debug_level == 0 && !debug_trace_memory)
   {
+    int i;
   int pid = fork();
   if (pid < 0) log_write(LOG_PANIC_DIE, "fork() failed: %s", strerror(errno));
   if (pid > 0) exit(EXIT_SUCCESS);      /* in parent process, just exit */
-  }


+                /* Dissociate from controlling tty */
+#ifdef HAVE_SETSID
+    (void)setsid();
+#else
+#ifdef HAVE_TIOCNOTTY
+    if ((i = open("/dev/tty", O_RDWR)) >= 0) {
+      if (ioctl(i, TIOCNOTTY, (char *)NULL) < 0)
+    log_write (LOG_PANIC_DIE, "%s cant ioctl(TIOCNOTTY) %s", LogName, strerror(errno));
+      if (close(i) < 0)
+    log_write (LOG_PANIC_DIE, "%s cant close /dev/tty %s", LogName, strerror(errno));
+    }
+#endif    /* HAVE_TIOCNOTTY */
+#endif /* HAVE_SETSID */
+
+  }


 /* If SMTP listening is requested, set up a socket on the SMTP port or
 a given port, and compile the verification acceptance data, if any, so
--- OS/os.h-HP-UX    1996/04/19 13:36:46    1.1
+++ OS/os.h-HP-UX    1996/04/19 13:36:53
@@ -2,6 +2,7 @@


 #define F_FREESP     O_TRUNC
 #define NEED_H_ERRNO 1
+#define HAVE_SETSID
 typedef struct flock flock_t;


/* End */