This commit was generated by cvs2svn to compensate for changes in r4969,
[chise/xemacs-chise.git.1] / src / process-unix.c
index 3523f6c..462fb55 100644 (file)
@@ -1288,7 +1288,7 @@ unix_send_process (Lisp_Object proc, struct lstream* lstream)
 
       while (1)
        {
-         ssize_t writeret;
+         Lstream_data_count writeret;
 
          chunklen = Lstream_read (lstream, chunkbuf, 512);
          if (chunklen <= 0)
@@ -1407,9 +1407,9 @@ static void
 try_to_initialize_subtty (struct unix_process_data *upd)
 {
   if (upd->pty_flag
-      && (upd->subtty = -1 || ! isatty (upd->subtty))
+      && (upd->subtty == -1 || ! isatty (upd->subtty))
       && STRINGP (upd->tty_name))
-    upd->subtty = open (XSTRING_DATA (upd->tty_name), O_RDWR, 0);
+    upd->subtty = open ((char *) XSTRING_DATA (upd->tty_name), O_RDWR, 0);
 }
 
 /* Send signal number SIGNO to PROCESS.
@@ -1475,9 +1475,21 @@ unix_kill_child_process (Lisp_Object proc, int signo,
      ioctl TIOCGPGRP it is supposed to obsolete.  Sometimes we have to
      use TIOCGPGRP on the master end, sometimes the slave end
      (probably an AIX bug).  So we better get a fd for the slave if we
-     haven't got it yet.  On some systems none of these work, so then
-     we just fall back to the non-current_group behavior and kill the
-     process group of the child. */
+     haven't got it yet.
+
+     Anal operating systems like SGI Irix and Compaq Tru64 adhere
+     strictly to the letter of the law, so our hack doesn't work.
+     The following fragment from an Irix header file is suggestive:
+
+     #ifdef __notdef__
+     // this is not currently supported
+     #define TIOCSIGNAL      (tIOC|31)       // pty: send signal to slave
+     #endif
+
+     On those systems where none of our tricks work, we just fall back
+     to the non-current_group behavior and kill the process group of
+     the child.
+  */
   if (current_group)
     {
       try_to_initialize_subtty (d);
@@ -1529,8 +1541,17 @@ unix_kill_child_process (Lisp_Object proc, int signo,
 
   /* Finally send the signal. */
   if (EMACS_KILLPG (pgid, signo) == -1)
-    error ("kill (%ld, %ld) failed: %s",
-          (long) pgid, (long) signo, strerror (errno));
+    {
+      /* It's not an error if our victim is already dead.
+        And we can't rely on the result of killing a zombie, since
+        XPG 4.2 requires that killing a zombie fail with ESRCH,
+        while FIPS 151-2 requires that it succeeds! */
+#ifdef ESRCH
+      if (errno != ESRCH)
+#endif
+       error ("kill (%ld, %ld) failed: %s",
+              (long) pgid, (long) signo, strerror (errno));
+    }
 }
 
 /* Send signal SIGCODE to any process in the system given its PID.