commit 82257467cbaabfce4db1b4a9f3f349214d3985c6
Author: Fabian Greffrath <fabian@greffrath.com>
AuthorDate: Mon Jan 20 22:11:48 2020 +0100
Commit: Fabian Greffrath <fabian@greffrath.com>
CommitDate: Mon Jan 20 22:11:48 2020 +0100
explicitly direct output to stdout if '-' is given as a file name
There is no mention in the POSIX documentation that fprintf() will
print to stdout if the NULL pointer is passed as the stream.
And, indeed, the current implementation triggers a segmentation fault
if invoked as '-statdump -'.
---
src/doom/statdump.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/doom/statdump.c b/src/doom/statdump.c
index 59f935a4..bbcdca7b 100644
--- a/src/doom/statdump.c
+++ b/src/doom/statdump.c
@@ -339,7 +339,7 @@ void StatDump(void)
}
else
{
- dumpfile = NULL;
+ dumpfile = stdout;
}
for (i = 0; i < num_captured_stats; ++i)
@@ -347,7 +347,7 @@ void StatDump(void)
PrintStats(dumpfile, &captured_stats[i]);
}
- if (dumpfile != NULL)
+ if (dumpfile != stdout)
{
fclose(dumpfile);
}