=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/paste/paste.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- src/usr.bin/paste/paste.c 2010/08/12 05:02:52 1.18 +++ src/usr.bin/paste/paste.c 2014/11/25 10:20:24 1.19 @@ -1,4 +1,4 @@ -/* $OpenBSD: paste.c,v 1.18 2010/08/12 05:02:52 tedu Exp $ */ +/* $OpenBSD: paste.c,v 1.19 2014/11/25 10:20:24 tobias Exp $ */ /* * Copyright (c) 1989 The Regents of the University of California. @@ -130,6 +130,8 @@ if (!(buf = fgetln(lp->fp, &len))) { if (!--opencnt) break; + if (lp->fp != stdin) + (void)fclose(lp->fp); lp->fp = NULL; if (output && lp->cnt && (ch = delim[(lp->cnt - 1) % delimcnt]))