From 80c4aec6318983623d39d1a73d6480ab7b6dba87 Mon Sep 17 00:00:00 2001 From: ksherlock Date: Mon, 22 Feb 2016 15:45:17 -0500 Subject: [PATCH] mkstemp fix `mkstemp` returns a file descriptor. Trying to `fopen`() that is a bad idea. --- initialize.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/initialize.c b/initialize.c index d02e3e9..98549c2 100644 --- a/initialize.c +++ b/initialize.c @@ -337,7 +337,7 @@ initializeStuff(int argc, char **argv) installCommandLineDefineSymbols(); if (listingOn) { - if ((saveFileForPass2 = fopen(mkstemp(pass2SourceFileName), + if ((saveFileForPass2 = fdopen(mkstemp(pass2SourceFileName), "w+")) == NULL) { fatalSystemError(UNABLE_TO_OPEN_PASS_2_FILE_ERROR, pass2SourceFileName); @@ -346,7 +346,7 @@ initializeStuff(int argc, char **argv) unlink(pass2SourceFileName); /* will take effect on program exit */ - if ((indexFileForPass2 = fopen(mkstemp(pass2IndexFileName), + if ((indexFileForPass2 = fdopen(mkstemp(pass2IndexFileName), "w+")) == NULL) { fatalSystemError(UNABLE_TO_OPEN_PASS_2_FILE_ERROR, pass2IndexFileName); @@ -356,7 +356,7 @@ initializeStuff(int argc, char **argv) program exit */ if (expandMacros) { - if ((macroFileForPass2 = fopen(mkstemp( + if ((macroFileForPass2 = fdopen(mkstemp( pass2MacroExpansionFileName),"w+")) == NULL) { fatalSystemError( UNABLE_TO_OPEN_PASS_2_FILE_ERROR,