diff --git a/src/log.c b/src/log.c index e4ae5ef7..3237c30e 100644 --- a/src/log.c +++ b/src/log.c @@ -598,11 +598,18 @@ log_init (const char *file, bool appendp) { if (file) { - logfp = fopen (file, appendp ? "a" : "w"); - if (!logfp) + if (HYPHENP (file)) { - fprintf (stderr, "%s: %s: %s\n", exec_name, file, strerror (errno)); - exit (WGET_EXIT_GENERIC_ERROR); + logfp = stdout; + } + else + { + logfp = fopen (file, appendp ? "a" : "w"); + if (!logfp) + { + fprintf (stderr, "%s: %s: %s\n", exec_name, file, strerror (errno)); + exit (WGET_EXIT_GENERIC_ERROR); + } } } else