fclose(ofile);
if (ofile && terminate_after_phase)
remove(outname);
+ ofile = NULL;
}
break;
if (!terminate_after_phase) {
ofmt->cleanup(using_debug_info);
cleanup_labels();
- } else {
- /*
- * Despite earlier comments, we need this fclose.
- * The object output drivers only fclose on cleanup,
- * and we just skipped that.
- */
- fclose (ofile);
+ fflush(ofile);
+ if (ferror(ofile)) {
+ report_error(ERR_NONFATAL|ERR_NOFILE,
+ "write error on output file `%s'", outname);
+ }
+ }
+ fclose(ofile);
+ if (ofile && terminate_after_phase)
remove(outname);
- }
+ ofile = NULL;
}
break;
}
if (ofile) {
fclose(ofile);
remove(outname);
+ ofile = NULL;
}
if (want_usage)
usage();
aout_fixup_relocs(&stext);
aout_fixup_relocs(&sdata);
aout_write();
- fclose(aoutfp);
saa_free(stext.data);
while (stext.head) {
r = stext.head;
(void)debuginfo;
as86_write();
- fclose(as86fp);
saa_free(stext.data);
while (stext.head) {
p = stext.head;
/* 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. */
(void)debuginfo;
coff_write();
- fclose(coffp);
for (i = 0; i < nsects; i++) {
if (sects[i]->data)
saa_free(sects[i]->data);
nasm_free(tmp->name);
nasm_free(tmp);
}
- fclose(dbgf);
}
static int32_t dbg_section_names(char *name, int pass, int *bits)
(void)debuginfo;
elf_write();
- fclose(elffp);
for (i = 0; i < nsects; i++) {
if (sects[i]->type != SHT_NOBITS)
saa_free(sects[i]->data);
(void)debuginfo;
elf_write();
- fclose(elffp);
for (i = 0; i < nsects; i++) {
if (sects[i]->type != SHT_NOBITS)
saa_free(sects[i]->data);
{
ieee_write_file(debuginfo);
of_ieee.current_dfmt->cleanup();
- fclose(ofp);
while (seghead) {
struct ieeeSection *segtmp = seghead;
seghead = seghead->next;
macho_calculate_sizes();
macho_write();
- /* done - yay! */
- fclose(machofp);
-
/* free up everything */
while (sects->next) {
s = sects;
macho_calculate_sizes();
macho_write();
- /* done - yay! */
- fclose(machofp);
-
/* free up everything */
while (sects->next) {
s = sects;
freemembuf(header);
freemembuf(seg[0]);
freemembuf(seg[1]);
- fclose(ofile);
}
static int32_t rdf_segbase(int32_t segment)
fwriteint32_t(0, ofile);
fwriteint32_t(0, ofile);
fwriteint16_t(0, ofile);
-
- fclose(ofile);
}
static int32_t rdf2_segbase(int32_t segment)