diff options
author | Nicolas Williams <nico@cryptonector.com> | 2014-08-20 20:49:30 -0500 |
---|---|---|
committer | Nicolas Williams <nico@cryptonector.com> | 2014-08-20 20:49:30 -0500 |
commit | 23e2e2eab3e09cd651295b361cfac4f03be0dd53 (patch) | |
tree | aae464e3f20fe5317ebc10a477157ee40d9fc239 | |
parent | 8d2d5e37e54ecfa823f0a5c6e9644aa2e97d5ee6 (diff) |
Quiet warning about freopen() of stdout
-rw-r--r-- | main.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -479,13 +479,18 @@ int main(int argc, char* argv[]) { } } if ((options & IN_PLACE)) { + FILE *devnull; #ifdef WIN32 - (void) freopen("NUL", "w+", stdout); + devnull = freopen("NUL", "w+", stdout); #else - (void) freopen("/dev/null", "w+", stdout); + devnull = freopen("/dev/null", "w+", stdout); #endif + if (devnull == NULL) { + fprintf(stderr, "Error: %s opening /dev/null\n", strerror(errno)); + exit(3); + } if (rename(t, input_filenames[0]) == -1) { - fprintf(stderr, "Error: %s renaming temporary file", strerror(errno)); + fprintf(stderr, "Error: %s renaming temporary file\n", strerror(errno)); exit(3); } jv_mem_free(t); |