diff options
author | Tobias Stoeckmann <tobias@cvs.openbsd.org> | 2014-11-25 10:20:25 +0000 |
---|---|---|
committer | Tobias Stoeckmann <tobias@cvs.openbsd.org> | 2014-11-25 10:20:25 +0000 |
commit | e3f36286d957c6c2a14bc2f9bb07bf3581d1b4d3 (patch) | |
tree | 3892b8921b9bd384b717507f681dfbf509f0a32e | |
parent | 8ea036d3ebd45bc605fb6638ff7cd4d719f48b2d (diff) |
Release file descriptors as soon as they are not needed anymore.
ok millert
-rw-r--r-- | usr.bin/paste/paste.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/paste/paste.c b/usr.bin/paste/paste.c index eeec15d5544..8bf14f8b1fb 100644 --- a/usr.bin/paste/paste.c +++ b/usr.bin/paste/paste.c @@ -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 @@ parallel(char **argv) 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])) |