diff --git a/sudo.c b/sudo.c index 2c538bc25..958c77b40 100644 --- a/sudo.c +++ b/sudo.c @@ -371,7 +371,7 @@ static void load_globals(sudo_mode) /* * Need to get tty early since it's used for logging */ - if ((tty = (char *) ttyname(0)) || (tty = (char *) ttyname(0))) { + if ((tty = (char *) ttyname(0)) || (tty = (char *) ttyname(1))) { if (strncmp(tty, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0) tty += sizeof(_PATH_DEV) - 1; if ((tty = strdup(tty)) == NULL) {