diff options
| author | Karoly Lorentey | 2004-06-08 00:46:13 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2004-06-08 00:46:13 +0000 |
| commit | 8516815bc226d01bf835dc609633938c3ccf4001 (patch) | |
| tree | 6fa2d0e7f647f9dc95eb925bc5bee9406e1919c2 /src | |
| parent | 420a53224b336e79f74d87c25fdef72f5c84cf34 (diff) | |
| download | emacs-8516815bc226d01bf835dc609633938c3ccf4001.tar.gz emacs-8516815bc226d01bf835dc609633938c3ccf4001.zip | |
Dissociate from the controlling tty correctly on FreeBSD.
* src/term.c (dissociate_if_controlling_tty): On some systems TIOCNOTTY
works only on /dev/tty. Adapt the function accordingly.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-194
Diffstat (limited to 'src')
| -rw-r--r-- | src/term.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/term.c b/src/term.c index a0e46f45cbd..b40e821e372 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -2256,26 +2256,29 @@ delete_initial_display (struct display *display) | |||
| 2256 | void | 2256 | void |
| 2257 | dissociate_if_controlling_tty (int fd) | 2257 | dissociate_if_controlling_tty (int fd) |
| 2258 | { | 2258 | { |
| 2259 | #if defined (USG) && !defined (BSD_PGRPS) | ||
| 2260 | int pgid; | 2259 | int pgid; |
| 2261 | EMACS_GET_TTY_PGRP (fd, &pgid); | 2260 | EMACS_GET_TTY_PGRP (fd, &pgid); /* If tcgetpgrp succeeds, fd is the ctty. */ |
| 2262 | if (pgid != -1) | 2261 | if (pgid != -1) |
| 2263 | { | 2262 | { |
| 2263 | #if defined (USG) && !defined (BSD_PGRPS) | ||
| 2264 | setpgrp (); | 2264 | setpgrp (); |
| 2265 | no_controlling_tty = 1; | 2265 | no_controlling_tty = 1; |
| 2266 | } | ||
| 2267 | #else | 2266 | #else |
| 2268 | #ifdef TIOCNOTTY /* Try BSD ioctls. */ | 2267 | #ifdef TIOCNOTTY /* Try BSD ioctls. */ |
| 2269 | sigblock (sigmask (SIGTTOU)); | 2268 | sigblock (sigmask (SIGTTOU)); |
| 2270 | if (ioctl (fd, TIOCNOTTY, 0) != -1) | 2269 | fd = emacs_open ("/dev/tty", O_RDWR, 0); |
| 2271 | { | 2270 | if (fd != -1 && ioctl (fd, TIOCNOTTY, 0) != -1) |
| 2272 | no_controlling_tty = 1; | 2271 | { |
| 2273 | } | 2272 | no_controlling_tty = 1; |
| 2274 | sigunblock (sigmask (SIGTTOU)); | 2273 | } |
| 2274 | if (fd != -1) | ||
| 2275 | emacs_close (fd); | ||
| 2276 | sigunblock (sigmask (SIGTTOU)); | ||
| 2275 | #else | 2277 | #else |
| 2276 | /* Unknown system. */ | 2278 | /* Unknown system. */ |
| 2277 | croak (); | 2279 | croak (); |
| 2278 | #endif /* ! TIOCNOTTY */ | 2280 | #endif /* ! TIOCNOTTY */ |
| 2281 | } | ||
| 2279 | #endif /* ! USG */ | 2282 | #endif /* ! USG */ |
| 2280 | } | 2283 | } |
| 2281 | 2284 | ||