Fix GCC 7 warning in the RTS
authorSylvain Henry <hsyl20@gmail.com>
Sun, 18 Jun 2017 20:50:09 +0000 (16:50 -0400)
committerBen Gamari <ben@smart-cactus.org>
Mon, 19 Jun 2017 12:15:44 +0000 (08:15 -0400)
Test Plan: validate

Reviewers: austin, bgamari, erikd, simonmar

Reviewed By: bgamari, simonmar

Subscribers: rwbarton, thomie

Differential Revision: https://phabricator.haskell.org/D3648

rts/RtsFlags.c

index b51d644..73635cf 100644 (file)
@@ -1559,6 +1559,10 @@ openStatsFile (char *filename,           // filename, or NULL
         if (*filename != '\0') {  /* stats file specified */
             f = fopen(filename,"w");
         } else {
+            if (filename_fmt == NULL) {
+                errorBelch("Invalid stats filename format (NULL)\n");
+                return -1;
+            }
             /* default <program>.<ext> */
             char stats_filename[STATS_FILENAME_MAXLEN];
             sprintf(stats_filename, filename_fmt, prog_name);