]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve init_tty readability
authorDaniel Colascione <dancol@dancol.org>
Sun, 23 Mar 2014 08:29:43 +0000 (01:29 -0700)
committerDaniel Colascione <dancol@dancol.org>
Sun, 23 Mar 2014 08:29:43 +0000 (01:29 -0700)
src/ChangeLog
src/term.c

index 36964f5743740404f0bc9edb89ca4bb84f19fd72..1cce3b5c48e76af2f5b20ad559ce4b61e66ca944 100644 (file)
@@ -1,3 +1,8 @@
+2014-03-23  Daniel Colascione  <dancol@dancol.org>
+
+       * term.c (init_tty): Rearrange condition for clarity; print
+       appropriate diagnostic.
+
 2014-03-23  Daniel Colascione  <dancol@dancol.org>
 
        * process.c (DATAGRAM_CONN_P): Don't underflow datagram_address
index 773e85faabcce14975eadcba901ad3c5ea6b5b3f..3bcbb70aff64a16d809d1577280db650767ec331 100644 (file)
@@ -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);
       }