summaryrefslogtreecommitdiff
path: root/src/emacs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/emacs.c')
-rw-r--r--src/emacs.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/emacs.c b/src/emacs.c
index e24b51e06e1..285911bf15d 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -292,8 +292,16 @@ main (argc, argv, envp)
#endif
clearerr (stdin);
+#if 0 /* Without EMACS_SET_TTY_PGRP, this causes Emacs to hang
+ when run under a non-job-control shell.
+ EMACS_SET_TTY_PGRP seems correct, but breaks even more. */
#ifdef BSD
- setpgrp (0, getpid ());
+ {
+ int pid = getpid ();
+ setpgrp (0, pid);
+ EMACS_SET_TTY_PGRP (0, &pid);
+ }
+#endif
#endif
#ifdef APOLLO
@@ -323,11 +331,6 @@ main (argc, argv, envp)
setuid (getuid ());
#endif /* PRIO_PROCESS */
-#ifdef BSD
- /* interrupt_input has trouble if we aren't in a separate process group. */
- setpgrp (getpid (), getpid ());
-#endif
-
inhibit_window_system = 0;
/* Handle the -t switch, which specifies filename to use as terminal */
@@ -677,7 +680,11 @@ shut_down_emacs (sig, no_x)
{
int tpgrp;
if (EMACS_GET_TTY_PGRP (0, &tpgrp) != -1
+#ifdef GETPGRP_NO_ARG
+ && tpgrp == getpgrp ())
+#else
&& tpgrp == getpgrp (0))
+#endif
{
fflush (stdout);
reset_sys_modes ();