aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorPaul Eggert2012-10-31 10:27:29 -0700
committerPaul Eggert2012-10-31 10:27:29 -0700
commit322aea6ddf7ec7fd71410d98ec1de69f219aff3e (patch)
tree5efe99d41566350e9793015cde6ebb656e1278e6 /src/process.c
parent220cb2bd70c65041417554cc2dc10edb4a53de5c (diff)
downloademacs-322aea6ddf7ec7fd71410d98ec1de69f219aff3e.tar.gz
emacs-322aea6ddf7ec7fd71410d98ec1de69f219aff3e.zip
Fix crash when using Emacs as commit editor for git.
* callproc.c (setpgrp): Remove macro, as we now use setpgid and it is configured in conf_post.h. (Fcall_process): Don't invoke both setsid and setpgid; the former is enough, if it exists. * callproc.c (Fcall_process, child_setup): * process.c (create_process): Use setpgid. * conf_post.h (setpgid) [!HAVE_SETPGID]: New macro, which substitutes for the real thing. * dispnew.c (init_display): Initialize the foreground group if we are running a tty display. * emacs.c (main): Do not worry about setpgrp; init_display does it now. * lisp.h (init_foreground_group): New decl. * sysdep.c (inherited_pgroup): New static var. (init_foreground_group, tcsetpgrp_without_stopping) (narrow_foreground_group, widen_foreground_group): New functions. (init_sys_modes): Narrow foreground group. (reset_sys_modes): Widen foreground group. Fixes: debbugs:12697
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/process.c b/src/process.c
index 307e82819d6..77e99ead01f 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1759,12 +1759,10 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1759#endif 1759#endif
1760 } 1760 }
1761#else /* not HAVE_SETSID */ 1761#else /* not HAVE_SETSID */
1762#ifdef USG 1762 /* It's very important to call setpgid here and no time
1763 /* It's very important to call setpgrp here and no time
1764 afterwards. Otherwise, we lose our controlling tty which 1763 afterwards. Otherwise, we lose our controlling tty which
1765 is set when we open the pty. */ 1764 is set when we open the pty. */
1766 setpgrp (); 1765 setpgid (0, 0);
1767#endif /* USG */
1768#endif /* not HAVE_SETSID */ 1766#endif /* not HAVE_SETSID */
1769#if defined (LDISC1) 1767#if defined (LDISC1)
1770 if (pty_flag && xforkin >= 0) 1768 if (pty_flag && xforkin >= 0)
@@ -1802,11 +1800,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1802 /* In order to get a controlling terminal on some versions 1800 /* In order to get a controlling terminal on some versions
1803 of BSD, it is necessary to put the process in pgrp 0 1801 of BSD, it is necessary to put the process in pgrp 0
1804 before it opens the terminal. */ 1802 before it opens the terminal. */
1805#ifdef HAVE_SETPGID
1806 setpgid (0, 0); 1803 setpgid (0, 0);
1807#else
1808 setpgrp (0, 0);
1809#endif
1810#endif 1804#endif
1811 } 1805 }
1812#endif /* TIOCNOTTY */ 1806#endif /* TIOCNOTTY */