[aot] Allow the redirection of aot profile output to an already opened fd using outfi...
authorZoltan Varga <vargaz@gmail.com>
Mon, 23 Jan 2017 10:48:54 +0000 (05:48 -0500)
committerZoltan Varga <vargaz@gmail.com>
Mon, 23 Jan 2017 10:48:54 +0000 (05:48 -0500)
mono/profiler/mono-profiler-aot.c

index 05ed0758ed2cfff00dea1280523e4e3abc7495c9..59f8aeea2a0a838e89d3cf8ca5422d65db89c60c 100644 (file)
@@ -368,7 +368,12 @@ prof_shutdown (MonoProfiler *prof)
 
        printf ("Creating output file: %s\n", prof->outfile_name);
 
-       outfile = fopen (prof->outfile_name, "w+");
+       if (prof->outfile_name [0] == '#') {
+               int fd = strtol (prof->outfile_name + 1, NULL, 10);
+               outfile = fdopen (fd, "a");
+       } else {
+               outfile = fopen (prof->outfile_name, "w+");
+       }
        if (!outfile) {
                fprintf (stderr, "Unable to create output file '%s': %s.\n", prof->outfile_name, strerror (errno));
                return;