diff --git a/os-posix.c b/os-posix.c
index ee765f047dea88e4cb9d4cf6faad4483ae20a872..faf6e6978b9f7c9a25d2ae458d9e1b0f9875d354 100644
--- a/os-posix.c
+++ b/os-posix.c
@@ -291,7 +291,7 @@ void os_setup_post(void)
         dup2(fd, 0);
         dup2(fd, 1);
         /* In case -D is given do not redirect stderr to /dev/null */
-        if (!qemu_logfile) {
+        if (!qemu_log_enabled()) {
             dup2(fd, 2);
         }