jeapostrophe / mic1

mic1
Other
21 stars 5 forks source link

Race condition in dump_table causes symbol table to go in the middle of output code #1

Closed shemphill closed 4 years ago

shemphill commented 4 years ago

Basically, stdout is buffered, and not fully written out when "sort" also starts writing to it. If the output is to a terminal, everything comes out in the proper order. But if stdout is redirected to a disk file, the symbol table always seems to appear starting in line 241 of my ~470 line output code. The fix is to do a "fflush(stdout)" somewhere. I put it in dump_table itself, and I also changed the "fclose/wait" combination to "pclose" which I feel is only proper for a pipe. Attached is a patch file.

masm-patch.txt

jeapostrophe commented 4 years ago

Thank you very much! I've applied the patch.