diff options
author | H. Peter Anvin <hpa@zytor.com> | 2009-07-12 12:11:52 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2009-07-12 12:15:35 -0700 |
commit | d0fbb7f0ab355fd4e73d1aab215a2aa387b615c3 (patch) | |
tree | 636f3b611b9fc5d630c547c9cbd65028f7ae360b /output/outbin.c | |
parent | 323fcff32bd5d48a690e14a72c980892924c05ab (diff) | |
download | nasm-d0fbb7f0ab355fd4e73d1aab215a2aa387b615c3.tar.gz |
Don't fclose() the output in the backend
We fopen() the output file in common code but fclose() it in the
backend. This is bad for a variety of reasons:
1. it is generally an awkward interface to change ownership.
2. we should use ferror() to test for write errors, and that is
better done in common code.
3. it requires more code.
4. we still need to fclose() in common code during error handing.
Thus, move the fclose() of the output out of the backends, and add
fflush() so we can test ferror() on output.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'output/outbin.c')
-rw-r--r-- | output/outbin.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/output/outbin.c b/output/outbin.c index 8942acfd..5dc8e978 100644 --- a/output/outbin.c +++ b/output/outbin.c @@ -593,7 +593,6 @@ static void bin_cleanup(int debuginfo) /* Step 6: Write the section data to the output file. */ do_output(); - fclose(fp); /* Done with the output file */ /* Step 7: Generate the map file. */ |