diff options
author | Tim Waugh <twaugh@redhat.com> | 2015-01-28 17:11:35 +0000 |
---|---|---|
committer | Andreas Gruenbacher <agruen@gnu.org> | 2015-01-31 18:25:12 +0100 |
commit | 75fcb4b560d40c7244831cba0bd49ff64f93a32d (patch) | |
tree | 57cf6c778f5bf862ae5f7aa146e70d0edb29aba1 | |
parent | 3e7113a6b5dd318608db0fb3a89777892253af34 (diff) | |
download | patch-75fcb4b560d40c7244831cba0bd49ff64f93a32d.tar.gz |
Avoid closing file descriptor twice
* src/patch.c (main): Make sure we don't close() outfd after passing it on to
fdopen(): the file descriptor might have been reused in the meantime.
-rw-r--r-- | src/patch.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/patch.c b/src/patch.c index cb4dbb2..7dafb54 100644 --- a/src/patch.c +++ b/src/patch.c @@ -339,6 +339,8 @@ main (int argc, char **argv) outstate.ofp = fdopen(outfd, binary_transput ? "wb" : "w"); if (! outstate.ofp) pfatal ("%s", TMPOUTNAME); + /* outstate.ofp now owns the file descriptor */ + outfd = -1; } /* find out where all the lines are */ |