From a31161883b07ae38dbb5e3b74ebf0131d2029bf8 Mon Sep 17 00:00:00 2001 From: Daniel Colascione Date: Sun, 23 Mar 2014 01:29:43 -0700 Subject: [PATCH] Improve init_tty readability --- src/ChangeLog | 5 +++++ src/term.c | 7 +++++-- 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,3 +1,8 @@ +2014-03-23 Daniel Colascione + + * term.c (init_tty): Rearrange condition for clarity; print + appropriate diagnostic. + 2014-03-23 Daniel Colascione * process.c (DATAGRAM_CONN_P): Don't underflow datagram_address 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) open a frame on the same terminal. */ int flags = O_RDWR | O_NOCTTY | (ctty ? 0 : O_IGNORE_CTTY); int fd = emacs_open (name, flags, 0); - tty->input = tty->output = fd < 0 || ! isatty (fd) ? 0 : fdopen (fd, "w+"); + tty->input = tty->output = + ((fd < 0 || ! isatty (fd)) + ? NULL + : fdopen (fd, "w+")); if (! tty->input) { char const *diagnostic - = tty->input ? "Not a tty device: %s" : "Could not open file: %s"; + = (fd < 0) ? "Could not open file: %s" : "Not a tty device: %s"; emacs_close (fd); maybe_fatal (must_succeed, terminal, diagnostic, diagnostic, name); } -- 2.39.5