diff --git a/sshpty.c b/sshpty.c index cae0b977a585..06098168beb1 100644 --- a/sshpty.c +++ b/sshpty.c @@ -117,7 +117,7 @@ pty_make_controlling_tty(int *ttyfd, const char *tty) * tty. */ fd = open(_PATH_TTY, O_RDWR | O_NOCTTY); - if (fd >= 0) { + if (fd < 0) { error("Failed to disconnect from controlling tty."); close(fd); }