diff --git a/src/lib/libutil/login_tty.c b/src/lib/libutil/login_tty.c index 7a7c6a44..3a0ce71a 100644 --- a/src/lib/libutil/login_tty.c +++ b/src/lib/libutil/login_tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: login_tty.c,v 1.7 2005/08/02 21:46:23 espie Exp $ */ +/* $OpenBSD: login_tty.c,v 1.8 2009/08/01 17:11:21 millert Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -40,10 +40,10 @@ login_tty(int fd) (void) setsid(); if (ioctl(fd, TIOCSCTTY, (char *)NULL) == -1) return (-1); - (void) dup2(fd, 0); - (void) dup2(fd, 1); - (void) dup2(fd, 2); - if (fd > 2) + (void) dup2(fd, STDIN_FILENO); + (void) dup2(fd, STDOUT_FILENO); + (void) dup2(fd, STDERR_FILENO); + if (fd > STDERR_FILENO) (void) close(fd); return (0); }