Because we pass the file descriptor from client to server, tmux can't
authornicm <nicm@openbsd.org>
Wed, 16 Apr 2014 08:02:31 +0000 (08:02 +0000)
committernicm <nicm@openbsd.org>
Wed, 16 Apr 2014 08:02:31 +0000 (08:02 +0000)
usefully work if stdin is /dev/tty. Complain about it more clearly.

usr.bin/tmux/server-client.c

index d27c9ea..73e061a 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: server-client.c,v 1.119 2014/02/23 00:53:06 nicm Exp $ */
+/* $OpenBSD: server-client.c,v 1.120 2014/04/16 08:02:31 nicm Exp $ */
 
 /*
  * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -119,6 +119,11 @@ server_client_open(struct client *c, char **cause)
        if (c->flags & CLIENT_CONTROL)
                return (0);
 
+       if (strcmp(c->ttyname, "/dev/tty") == 0) {
+               *cause = xstrdup("can't use /dev/tty");
+               return (-1);
+       }
+
        if (!(c->flags & CLIENT_TERMINAL)) {
                *cause = xstrdup("not a terminal");
                return (-1);