[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r116711: Fix emacsclient terminal corruption when in
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] trunk r116711: Fix emacsclient terminal corruption when in background. |
Date: |
Sun, 09 Mar 2014 22:38:20 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 116711
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/16892
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sun 2014-03-09 15:38:15 -0700
message:
Fix emacsclient terminal corruption when in background.
* emacsclient.c (handle_sigcont): Check for tcgetpgrp failure.
Cancel the continue only if tty. Send SIGTTIN to the process
group, not SIGSTOP to self, as this is what the glibc manual
recommends.
(main): If tty, and if started in the background, send SIGTTIN
to the process group.
modified:
lib-src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1608
lib-src/emacsclient.c
emacsclient.c-20091113204419-o5vbwnq5f7feedwu-283
=== modified file 'lib-src/ChangeLog'
--- a/lib-src/ChangeLog 2014-03-03 04:57:26 +0000
+++ b/lib-src/ChangeLog 2014-03-09 22:38:15 +0000
@@ -1,3 +1,13 @@
+2014-03-09 Paul Eggert <address@hidden>
+
+ Fix emacsclient terminal corruption when in background (Bug#16892).
+ * emacsclient.c (handle_sigcont): Check for tcgetpgrp failure.
+ Cancel the continue only if tty. Send SIGTTIN to the process
+ group, not SIGSTOP to self, as this is what the glibc manual
+ recommends.
+ (main): If tty, and if started in the background, send SIGTTIN
+ to the process group.
+
2014-02-25 Andreas Amann <address@hidden> (tiny change)
Fix emacsclient's handling of SIGCONT (Bug#16883).
=== modified file 'lib-src/emacsclient.c'
--- a/lib-src/emacsclient.c 2014-02-25 19:06:53 +0000
+++ b/lib-src/emacsclient.c 2014-03-09 22:38:15 +0000
@@ -1105,16 +1105,18 @@
handle_sigcont (int signalnum)
{
int old_errno = errno;
+ pid_t pgrp = getpgrp ();
+ pid_t tcpgrp = tcgetpgrp (1);
- if (tcgetpgrp (1) == getpgrp ())
+ if (tcpgrp == pgrp)
{
/* We are in the foreground. */
send_to_emacs (emacs_socket, "-resume \n");
}
- else if (tty)
+ else if (0 <= tcpgrp && tty)
{
/* We are in the background; cancel the continue. */
- raise (SIGSTOP);
+ kill (-pgrp, SIGTTIN);
}
signal (signalnum, handle_sigcont);
@@ -1554,6 +1556,14 @@
exit (EXIT_FAILURE);
}
+ if (tty)
+ {
+ pid_t pgrp = getpgrp ();
+ pid_t tcpgrp = tcgetpgrp (1);
+ if (0 <= tcpgrp && tcpgrp != pgrp)
+ kill (-pgrp, SIGTTIN);
+ }
+
/* If alternate_editor is the empty string, start the emacs daemon
in case of failure to connect. */
start_daemon_if_needed = (alternate_editor
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r116711: Fix emacsclient terminal corruption when in background.,
Paul Eggert <=