diff options
| author | Karoly Lorentey | 2007-01-01 18:32:06 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2007-01-01 18:32:06 +0000 |
| commit | 382707ecfb50f8c7794a7ba3d8cd9db9b6cd29d0 (patch) | |
| tree | db97fc28e75e5d3b4db1f2c8b87b1bc65770b5ef /lib-src | |
| parent | 65e86587ab836aaa86b12ce30b219bcb4fcbaa06 (diff) | |
| download | emacs-382707ecfb50f8c7794a7ba3d8cd9db9b6cd29d0.tar.gz emacs-382707ecfb50f8c7794a7ba3d8cd9db9b6cd29d0.zip | |
Fix various suspend-related bugs in emacsclient. (Report & patch by Dan Nicolaescu.)
* lib-src/emacsclient.c (in, out): Remove.
(s): New variable (moved out from main).
(handle_sigcont, handle_sigtstp): Use SEND_STRING.
(main): Fix typos.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-591
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/emacsclient.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index f765f02b426..4486c94660c 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c | |||
| @@ -171,8 +171,8 @@ char *server_file = NULL; | |||
| 171 | /* PID of the Emacs server process. */ | 171 | /* PID of the Emacs server process. */ |
| 172 | int emacs_pid = 0; | 172 | int emacs_pid = 0; |
| 173 | 173 | ||
| 174 | /* File handles for communicating with Emacs. */ | 174 | /* Socket used to communicate with the Emacs server process. */ |
| 175 | FILE *out, *in; | 175 | HSOCKET s; |
| 176 | 176 | ||
| 177 | void print_help_and_exit () NO_RETURN; | 177 | void print_help_and_exit () NO_RETURN; |
| 178 | 178 | ||
| @@ -906,9 +906,7 @@ handle_sigcont (int signalnum) | |||
| 906 | if (tcgetpgrp (1) == getpgrp ()) | 906 | if (tcgetpgrp (1) == getpgrp ()) |
| 907 | { | 907 | { |
| 908 | /* We are in the foreground. */ | 908 | /* We are in the foreground. */ |
| 909 | fprintf (out, "-resume \n"); | 909 | SEND_STRING ("-resume \n"); |
| 910 | fflush (out); | ||
| 911 | fsync (fileno (out)); | ||
| 912 | } | 910 | } |
| 913 | else | 911 | else |
| 914 | { | 912 | { |
| @@ -932,12 +930,8 @@ handle_sigtstp (int signalnum) | |||
| 932 | int old_errno = errno; | 930 | int old_errno = errno; |
| 933 | sigset_t set; | 931 | sigset_t set; |
| 934 | 932 | ||
| 935 | if (out) | 933 | if (s) |
| 936 | { | 934 | SEND_STRING ("-suspend \n"); |
| 937 | fprintf (out, "-suspend \n"); | ||
| 938 | fflush (out); | ||
| 939 | fsync (fileno (out)); | ||
| 940 | } | ||
| 941 | 935 | ||
| 942 | /* Unblock this signal and call the default handler by temprarily | 936 | /* Unblock this signal and call the default handler by temprarily |
| 943 | changing the handler and resignalling. */ | 937 | changing the handler and resignalling. */ |
| @@ -1240,7 +1234,6 @@ main (argc, argv) | |||
| 1240 | int argc; | 1234 | int argc; |
| 1241 | char **argv; | 1235 | char **argv; |
| 1242 | { | 1236 | { |
| 1243 | HSOCKET s; | ||
| 1244 | int i, rl, needlf = 0; | 1237 | int i, rl, needlf = 0; |
| 1245 | char *cwd, *str; | 1238 | char *cwd, *str; |
| 1246 | char string[BUFSIZ+1]; | 1239 | char string[BUFSIZ+1]; |
| @@ -1410,7 +1403,7 @@ main (argc, argv) | |||
| 1410 | SEND_STRING ("-eval "); | 1403 | SEND_STRING ("-eval "); |
| 1411 | else | 1404 | else |
| 1412 | SEND_STRING ("-file "); | 1405 | SEND_STRING ("-file "); |
| 1413 | SEND_QUOTED (out); | 1406 | SEND_QUOTED (str); |
| 1414 | } | 1407 | } |
| 1415 | SEND_STRING (" "); | 1408 | SEND_STRING (" "); |
| 1416 | } | 1409 | } |
| @@ -1473,7 +1466,7 @@ main (argc, argv) | |||
| 1473 | fprintf (stderr, "*ERROR*: %s", str); | 1466 | fprintf (stderr, "*ERROR*: %s", str); |
| 1474 | needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; | 1467 | needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; |
| 1475 | } | 1468 | } |
| 1476 | else if (strprefix ("-suspend ", str)) | 1469 | else if (strprefix ("-suspend ", string)) |
| 1477 | { | 1470 | { |
| 1478 | /* -suspend: Suspend this terminal, i.e., stop the process. */ | 1471 | /* -suspend: Suspend this terminal, i.e., stop the process. */ |
| 1479 | if (needlf) | 1472 | if (needlf) |