From e0da156dda98b6ce364eeafaf7881d8d311ad04d Mon Sep 17 00:00:00 2001 From: rlar Date: Sat, 2 Jul 2011 15:31:19 +0000 Subject: [PATCH] main.c, cleanup --- src/main.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index fd536155b..a802126b4 100644 --- a/src/main.c +++ b/src/main.c @@ -1004,15 +1004,21 @@ main(int argc, char **argv) /* Open the log file */ #ifdef HAS_WINDOWS /* flogp used by winmain's putc which writes to file 'buf' */ - if ((flogp = fopen(buf, "w")) == NULL) { + flogp = fopen(buf, "w"); + if (!flogp) { + perror (buf); + sp_shutdown (EXIT_BAD); + } + oflag = TRUE; /* All further output to -o log file */ #else /* Connect stdout to file buf and log stdout */ - if (!(freopen (buf, "w", stdout))) { -#endif + if (!freopen (buf, "w", stdout)) { perror (buf); sp_shutdown (EXIT_BAD); } +#endif } /* orflag */ + #ifdef SIMULATOR if_getparam = spif_getparam_special; #else