From: deraadt Date: Fri, 10 May 1996 12:58:04 +0000 (+0000) Subject: torek fix to close old descriptor silently X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d5bf2d0a38cdeacdd654d8768fa925ad8d72933d;p=openbsd torek fix to close old descriptor silently --- diff --git a/lib/libc/stdio/freopen.c b/lib/libc/stdio/freopen.c index 85d3ed2646f..e5e0b53e84b 100644 --- a/lib/libc/stdio/freopen.c +++ b/lib/libc/stdio/freopen.c @@ -1,4 +1,4 @@ -/* $NetBSD: freopen.c,v 1.4 1995/02/02 02:09:36 jtc Exp $ */ +/* $NetBSD: freopen.c,v 1.5 1996/05/04 19:25:19 mycroft Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -40,7 +40,7 @@ #if 0 static char sccsid[] = "@(#)freopen.c 8.1 (Berkeley) 6/4/93"; #endif -static char rcsid[] = "$NetBSD: freopen.c,v 1.4 1995/02/02 02:09:36 jtc Exp $"; +static char rcsid[] = "$NetBSD: freopen.c,v 1.5 1996/05/04 19:25:19 mycroft Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -114,7 +114,7 @@ freopen(file, mode, fp) * keep fp->_base: it may be the wrong size. This loses the effect * of any setbuffer calls, but stdio has always done this before. */ - if (isopen) + if (isopen && f != wantfd) (void) (*fp->_close)(fp->_cookie); if (fp->_flags & __SMBF) free((char *)fp->_bf._base);