From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56396) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afTUX-0000Rk-47 for qemu-devel@nongnu.org; Mon, 14 Mar 2016 10:29:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1afTUT-0008T5-3M for qemu-devel@nongnu.org; Mon, 14 Mar 2016 10:29:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59456) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afTUS-0008T1-U7 for qemu-devel@nongnu.org; Mon, 14 Mar 2016 10:29:01 -0400 References: <1457954501-26528-1-git-send-email-den@openvz.org> <1457954501-26528-4-git-send-email-den@openvz.org> From: Paolo Bonzini Message-ID: <56E6CAA9.9020908@redhat.com> Date: Mon, 14 Mar 2016 15:28:57 +0100 MIME-Version: 1.0 In-Reply-To: <1457954501-26528-4-git-send-email-den@openvz.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/9] log: improve code in do_qemu_set_log List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Denis V. Lunev" Cc: qemu-devel@nongnu.org, Stefan Hajnoczi On 14/03/2016 12:21, Denis V. Lunev wrote: > /* In case -D is given do not redirect stderr to /dev/null */ > - if (!qemu_logfile) { > + if (!qemu_logfile || qemu_logfile == stderr) { > dup2(fd, 2); This relies on knowledge that fileno(qemu_logfile) is dup-ed to stderr. I'm not sure what's the problem in commit c586eac33; the idea is that, if -daemonize is given, a named logfile should always be open (so that stderr is redirected) but stderr should not be used as log destination (because that's just /dev/null). That's clear from the condition: is_daemonized() ? logfilename != NULL : qemu_loglevel Paolo