aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Colascione2014-03-23 01:29:43 -0700
committerDaniel Colascione2014-03-23 01:29:43 -0700
commita31161883b07ae38dbb5e3b74ebf0131d2029bf8 (patch)
tree03314f5130ca8074ff4ff80a09cfa0f01c1d9d72 /src
parent6ddc44225e743e2b2a0d5c192f50aefd7a4a915b (diff)
downloademacs-a31161883b07ae38dbb5e3b74ebf0131d2029bf8.tar.gz
emacs-a31161883b07ae38dbb5e3b74ebf0131d2029bf8.zip
Improve init_tty readability
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/term.c7
2 files changed, 10 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 36964f57437..1cce3b5c48e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,10 @@
12014-03-23 Daniel Colascione <dancol@dancol.org> 12014-03-23 Daniel Colascione <dancol@dancol.org>
2 2
3 * term.c (init_tty): Rearrange condition for clarity; print
4 appropriate diagnostic.
5
62014-03-23 Daniel Colascione <dancol@dancol.org>
7
3 * process.c (DATAGRAM_CONN_P): Don't underflow datagram_address 8 * process.c (DATAGRAM_CONN_P): Don't underflow datagram_address
4 array. (ASAN caught.) 9 array. (ASAN caught.)
5 10
diff --git a/src/term.c b/src/term.c
index 773e85faabc..3bcbb70aff6 100644
--- a/src/term.c
+++ b/src/term.c
@@ -4031,12 +4031,15 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed)
4031 open a frame on the same terminal. */ 4031 open a frame on the same terminal. */
4032 int flags = O_RDWR | O_NOCTTY | (ctty ? 0 : O_IGNORE_CTTY); 4032 int flags = O_RDWR | O_NOCTTY | (ctty ? 0 : O_IGNORE_CTTY);
4033 int fd = emacs_open (name, flags, 0); 4033 int fd = emacs_open (name, flags, 0);
4034 tty->input = tty->output = fd < 0 || ! isatty (fd) ? 0 : fdopen (fd, "w+"); 4034 tty->input = tty->output =
4035 ((fd < 0 || ! isatty (fd))
4036 ? NULL
4037 : fdopen (fd, "w+"));
4035 4038
4036 if (! tty->input) 4039 if (! tty->input)
4037 { 4040 {
4038 char const *diagnostic 4041 char const *diagnostic
4039 = tty->input ? "Not a tty device: %s" : "Could not open file: %s"; 4042 = (fd < 0) ? "Could not open file: %s" : "Not a tty device: %s";
4040 emacs_close (fd); 4043 emacs_close (fd);
4041 maybe_fatal (must_succeed, terminal, diagnostic, diagnostic, name); 4044 maybe_fatal (must_succeed, terminal, diagnostic, diagnostic, name);
4042 } 4045 }