use ir_export_file so we can also export to stdout
authorMatthias Braun <matze@braunis.de>
Thu, 17 Nov 2011 16:33:03 +0000 (17:33 +0100)
committerMatthias Braun <matze@braunis.de>
Thu, 17 Nov 2011 16:45:26 +0000 (17:45 +0100)
main.c

diff --git a/main.c b/main.c
index 328ffac..369e5e6 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1943,8 +1943,11 @@ graph_built:
                        }
 
                        if (mode == CompileExportIR) {
-                               fclose(out);
-                               ir_export(outname);
+                               ir_export_file(out);
+                               if (ferror(out) != 0) {
+                                       fprintf(stderr, "Error while writing to output\n");
+                                       return EXIT_FAILURE;
+                               }
                                return EXIT_SUCCESS;
                        }