]> code.delx.au - gnu-emacs/blobdiff - src/process.c
* lisp/mail/rmailsum.el: Commas no longer separate regexps. (Bug#19026)
[gnu-emacs] / src / process.c
index fbc634be49c243774bbe802eae7bb66ee46b4abc..ce78d818e2984f11a941edb7c999966713ed426f 100644 (file)
@@ -136,8 +136,8 @@ extern int sys_select (int, fd_set *, fd_set *, fd_set *,
 
 /* Work around GCC 4.7.0 bug with strict overflow checking; see
    <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52904>.
-   These lines can be removed once the GCC bug is fixed.  */
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+   This bug appears to be fixed in GCC 5.1, so don't work around it there.  */
+#if __GNUC__ == 4 && __GNUC_MINOR__ >= 3
 # pragma GCC diagnostic ignored "-Wstrict-overflow"
 #endif
 \f
@@ -1220,8 +1220,8 @@ list of keywords.  */)
   if (NILP (key) && SERIALCONN_P (process))
     return list2 (Fplist_get (contact, QCport),
                  Fplist_get (contact, QCspeed));
-  /* FIXME: Return a meaningful value (e.g. the child ends of pipe),
-     if pipe process is useful for other purposes than receiving
+  /* FIXME: Return a meaningful value (e.g., the child end of the pipe)
+     if the pipe process is useful for purposes other than receiving
      stderr.  */
   if (NILP (key) && PIPECONN_P (process))
     return Qt;
@@ -1483,8 +1483,8 @@ usage: (make-process &rest ARGS)  */)
   pset_plist (XPROCESS (proc), Qnil);
   pset_type (XPROCESS (proc), Qreal);
   pset_buffer (XPROCESS (proc), buffer);
-  pset_sentinel (XPROCESS (proc), Qinternal_default_process_sentinel);
-  pset_filter (XPROCESS (proc), Qinternal_default_process_filter);
+  pset_sentinel (XPROCESS (proc), Fplist_get (contact, QCsentinel));
+  pset_filter (XPROCESS (proc), Fplist_get (contact, QCfilter));
   pset_command (XPROCESS (proc), Fcopy_sequence (command));
 
   if (tem = Fplist_get (contact, QCnoquery), !NILP (tem))
@@ -1751,7 +1751,7 @@ static void
 create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
 {
   struct Lisp_Process *p = XPROCESS (process);
-  int inchannel, outchannel, errchannel = -1;
+  int inchannel, outchannel;
   pid_t pid;
   int vfork_errno;
   int forkin, forkout, forkerr = -1;
@@ -1798,7 +1798,6 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
          struct Lisp_Process *pp = XPROCESS (p->stderrproc);
 
          forkerr = pp->open_fd[SUBPROCESS_STDOUT];
-         errchannel = pp->open_fd[READ_FROM_SUBPROCESS];
 
          /* Close unnecessary file descriptors.  */
          close_process_fd (&pp->open_fd[WRITE_TO_SUBPROCESS]);
@@ -2128,7 +2127,7 @@ usage:  (make-pipe-process &rest ARGS)  */)
   struct Lisp_Process *p;
   struct gcpro gcpro1;
   Lisp_Object name, buffer;
-  Lisp_Object tem, val;
+  Lisp_Object tem;
   ptrdiff_t specpdl_count;
   int inchannel, outchannel;
 
@@ -2203,7 +2202,7 @@ usage:  (make-pipe-process &rest ARGS)  */)
 
   {
     /* Setup coding systems for communicating with the network stream.  */
-    struct gcpro gcpro1;
+
     /* Qt denotes we have not yet called Ffind_operation_coding_system.  */
     Lisp_Object coding_systems = Qt;
     Lisp_Object val;
@@ -4786,37 +4785,41 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
       if (wait_proc && wait_proc->raw_status_new)
        update_status (wait_proc);
       if (wait_proc
-         && wait_proc->infd >= 0
          && ! EQ (wait_proc->status, Qrun)
          && ! EQ (wait_proc->status, Qconnect))
        {
          bool read_some_bytes = false;
 
          clear_waiting_for_input ();
-         XSETPROCESS (proc, wait_proc);
 
-         /* Read data from the process, until we exhaust it.  */
-         while (true)
+         /* If data can be read from the process, do so until exhausted.  */
+         if (wait_proc->infd >= 0)
            {
-             int nread = read_process_output (proc, wait_proc->infd);
-             if (nread < 0)
+             XSETPROCESS (proc, wait_proc);
+
+             while (true)
                {
-                 if (errno == EIO || errno == EAGAIN)
-                   break;
+                 int nread = read_process_output (proc, wait_proc->infd);
+                 if (nread < 0)
+                   {
+                   if (errno == EIO || errno == EAGAIN)
+                     break;
 #ifdef EWOULDBLOCK
-                 if (errno == EWOULDBLOCK)
-                   break;
+                   if (errno == EWOULDBLOCK)
+                     break;
 #endif
-               }
-             else
-               {
-                 if (got_some_input < nread)
-                   got_some_input = nread;
-                 if (nread == 0)
-                   break;
-                 read_some_bytes = true;
+                   }
+                 else
+                   {
+                     if (got_some_input < nread)
+                       got_some_input = nread;
+                     if (nread == 0)
+                       break;
+                     read_some_bytes = true;
+                   }
                }
            }
+
          if (read_some_bytes && do_display)
            redisplay_preserve_echo_area (10);
 
@@ -7499,40 +7502,6 @@ init_process_emacs (void)
   memset (datagram_address, 0, sizeof datagram_address);
 #endif
 
- {
-   Lisp_Object subfeatures = Qnil;
-   const struct socket_options *sopt;
-
-#define ADD_SUBFEATURE(key, val) \
-  subfeatures = pure_cons (pure_cons (key, pure_cons (val, Qnil)), subfeatures)
-
-#ifdef NON_BLOCKING_CONNECT
-   ADD_SUBFEATURE (QCnowait, Qt);
-#endif
-#ifdef DATAGRAM_SOCKETS
-   ADD_SUBFEATURE (QCtype, Qdatagram);
-#endif
-#ifdef HAVE_SEQPACKET
-   ADD_SUBFEATURE (QCtype, Qseqpacket);
-#endif
-#ifdef HAVE_LOCAL_SOCKETS
-   ADD_SUBFEATURE (QCfamily, Qlocal);
-#endif
-   ADD_SUBFEATURE (QCfamily, Qipv4);
-#ifdef AF_INET6
-   ADD_SUBFEATURE (QCfamily, Qipv6);
-#endif
-#ifdef HAVE_GETSOCKNAME
-   ADD_SUBFEATURE (QCservice, Qt);
-#endif
-   ADD_SUBFEATURE (QCserver, Qt);
-
-   for (sopt = socket_options; sopt->name; sopt++)
-     subfeatures = pure_cons (intern_c_string (sopt->name), subfeatures);
-
-   Fprovide (intern_c_string ("make-network-process"), subfeatures);
- }
-
 #if defined (DARWIN_OS)
   /* PTYs are broken on Darwin < 6, but are sometimes useful for interactive
      processes.  As such, we only change the default value.  */
@@ -7754,4 +7723,39 @@ The variable takes effect when `start-process' is called.  */);
   defsubr (&Sprocess_inherit_coding_system_flag);
   defsubr (&Slist_system_processes);
   defsubr (&Sprocess_attributes);
+
+ {
+   Lisp_Object subfeatures = Qnil;
+   const struct socket_options *sopt;
+
+#define ADD_SUBFEATURE(key, val) \
+  subfeatures = pure_cons (pure_cons (key, pure_cons (val, Qnil)), subfeatures)
+
+#ifdef NON_BLOCKING_CONNECT
+   ADD_SUBFEATURE (QCnowait, Qt);
+#endif
+#ifdef DATAGRAM_SOCKETS
+   ADD_SUBFEATURE (QCtype, Qdatagram);
+#endif
+#ifdef HAVE_SEQPACKET
+   ADD_SUBFEATURE (QCtype, Qseqpacket);
+#endif
+#ifdef HAVE_LOCAL_SOCKETS
+   ADD_SUBFEATURE (QCfamily, Qlocal);
+#endif
+   ADD_SUBFEATURE (QCfamily, Qipv4);
+#ifdef AF_INET6
+   ADD_SUBFEATURE (QCfamily, Qipv6);
+#endif
+#ifdef HAVE_GETSOCKNAME
+   ADD_SUBFEATURE (QCservice, Qt);
+#endif
+   ADD_SUBFEATURE (QCserver, Qt);
+
+   for (sopt = socket_options; sopt->name; sopt++)
+     subfeatures = pure_cons (intern_c_string (sopt->name), subfeatures);
+
+   Fprovide (intern_c_string ("make-network-process"), subfeatures);
+ }
+
 }